Comments (20)
And httpc version of the same suite finishes in 5s
from hackney.
@qrilka what do you mean by "HTTPS requests through proxy?"
from hackney.
e.g. hackney:request(get, "https://some-url.com", [], [], [{proxy,{"proxy", 8080}}])
from hackney.
I don't see any slowness right now... The code is pretty straightforward. The only cause I see right now is the use of TCP_KEEPALIVE when creating the connection. Also the socket is upgraded to handle ssl and reuse sessions .
Still investigating on it. Can you share the code of your mocking server?
from hackney.
Looks like the problems come the line https://github.com/benoitc/hackney/blob/master/src/hackney_connect.erl#L192 - would you mind to explain why do we need to check ipv6 of the host requested through the proxy?
In our testcase we use fake domain names and so the slowdown comes from DNS query inside inet:getaddr
.
from hackney.
And also I don't undestand why don't I see the same slowdown for HTTP requests
from hackney.
Why do you think there is no need to check if the host is under ipv6? What if you're using an ipv6 http proxy?
from hackney.
And what's the point of that check? hackney connects to the proxy and not to the target host
from hackney.
the host checked is the proxy one here....
from hackney.
argh never mind. I will come with a patch since you still need to check if you're using an ipv6 host for the proxy
from hackney.
And it looks like you don't pass any options when connecting to CONNECT proxy - https://github.com/benoitc/hackney/blob/master/src/hackney_http_connect.erl#L46
from hackney.
So it looks like proxy and host are mixed up somewhere around https://github.com/benoitc/hackney/blob/master/src/hackney.erl#L673
from hackney.
Yes. because you dont' want to there normally. Will figure how to handle better defaults.
Anyway the the patch I am thinking of is this one:
-
ProxyHost and ProxyPort should be passed as main arguments. And pass the target in options. Ie something like:
hackney_http_connect: connect(ProxyHost, ProxyHost, Opts, Timeout).
The connect host and port would contain the host and port we are connecting to. Imo the old logic is wrong.
-
Cache resolving. Once we detected that we connect using ipv6 to an host, we should cache it. So we don't do the test 2 times.
Thoughts?
from hackney.
@qrilka indeed ....
from hackney.
Totally agree with your idea.
from hackney.
@qrilka can you test #99 and let me know if works for you ?
from hackney.
Looks like you have an error in dealing with headers:
6> hackney:get("http://httpbin.org/get",[],[],[{proxy,{"localhost", 8080}}]).
=ERROR REPORT==== 18-Apr-2014::09:29:26 ===
proxy error: <<72,84,84,80,47,49,46,48,32,52,48,48,32,66,97,100,32,82,101,113,117,101,115,116,13,10,83,101,114,118,101,114,58,32,116,105,110,121,112,114,111,120,121,47,49,46,56,46,51,13,10,67,111,110,116,101,110,116,45,84,121,112,101,58,32,116,101,120,116,47,104,116,109,108,13,10,67,111,110,110,101,99,116,105,111,110,58,32,99,108,111,115,101,13,10,13,10>>
false
And in Wireshark I see
Hosthttpbin.org
for CONNECT request
Unfortunaltely I don't have time to dig further at this moment
from hackney.
Sorry I broke the correct behaviour in d6200c3. It's fixed in d704dc3 :
1> hackney:start().
ok
2> {ok, _, _, Ref} = hackney:get("http://httpbin.org/get",[],[],[{proxy,{"localhost", 8888}}]).
{ok,200,
[{<<"Via">>,<<"1.1 tinyproxy (tinyproxy/1.8.3)">>},
{<<"Content-Length">>,<<"343">>},
{<<"Date">>,<<"Fri, 18 Apr 2014 07:05:36 GMT">>},
{<<"Access-Control-Allow-Origin">>,<<"*">>},
{<<"Content-Type">>,<<"application/json">>},
{<<"Server">>,<<"gunicorn/0.17.4">>}],
#Ref<0.0.0.100>}
3> hackney:body(Ref).
{ok,<<"{\n \"url\": \"http://httpbin.org/get\",\n \"args\": {},\n \"origin\": \"88.163.70.217\",\n \"headers\": {\n \"Host\": \""...>>}
from hackney.
@qrilka I merged the PR with fixes in master. Everything seems OK here.
I also added a test to test multiple connections over proxy in f0dc107 . Not sure if you will be able to test it today but that would be cool so I can eventually close this issue.
Thanks for the report anyway!
from hackney.
Works like a charm, thanks
from hackney.
Related Issues (20)
- replace httpbin in tests
- Hackney checkout_failure which was working before 1.16.0 HOT 15
- hackney slow on reading chunked reply of ~20mb HOT 1
- Incorrect Host header used on redirected requests HOT 2
- Hackney should ignore 1XX responses HOT 1
- Status codes as floats HOT 2
- Connection timeout errors
- Authorization header on redirect
- Need a way to set filename for Content-Disposition when uploading file-data from memory HOT 4
- invalid_proxy_transport - returned with https proxy requesting https host HOT 7
- relative paths in the location header are not properly redirected
- parse_trans needed at runtime?
- Incorrect URL parsing when path is not set and query contains `/` character HOT 2
- Pool connection not freed when response code is 307 (with example! :tada: ) HOT 1
- Failing to access localhost on macOS
- Multiple Cookie headers in request HOT 1
- `content-type` corrupted if supplied as list/string instead of binary HOT 1
- ssl:recv/3 called with negative Length HOT 9
- GET request with basic authorization -- "HTTP request failed: bad_request" HOT 2
- Hackney can not handle very large responses. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hackney.