Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async https request from behind proxy fails. #223

Closed
cs-codesocial opened this issue Aug 11, 2015 · 7 comments
Closed

Async https request from behind proxy fails. #223

cs-codesocial opened this issue Aug 11, 2015 · 7 comments

Comments

@cs-codesocial
Copy link

Erlang 18.0 / Elixir 1.0.5

:hackney.request(:get, "https://example.com", ["Connection": "keep-alive"], [], [:async, insecure: true, proxy: "http://127.0.0.1:9001"])

{:ok, #Reference<0.0.1.147>}

iex(9)> 

19:22:50.971 [error] Unexpected message: {:ssl, {:sslsocket, {:gen_tcp, #Port<0.6604>, :tls_connection, 
:undefined}, #PID<0.162.0>}, "HTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nCache-Control: max-
age=604800\r\nContent-Type: text/html\r\nDate: Tue, 11 Aug 2015 17:22:51 GMT\r\nEtag: 
\"359670651\"\r\nExpires: Tue, 18 Aug 2015 17:22:51 GMT\r\nLast-Modified: Fri, 09 Aug 2013 23:54:35
 GMT\r\nServer: ECS (iad/18CB)\r\nX-Cache: HIT\r\nx-ec-custom-error: 1\r\nContent-Length: 
1270\r\n\r\n<!doctype html>\n<html>\n<head>\n    <title>Example Domain</title>\n\n    <meta 
charset=\"utf-8\" />\n    <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n  
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <style 
type=\"text/css\">\n    body {\n        background-color: #f0f0f2;\n        margin: 0;\n        padding: 0;\n    
    font-family: \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n        \n    }\n    div {\n 
       width: 600px;\n        margin: 5em auto;\n        padding: 50px;\n        background-color: #fff;\n   
     border-radius: 1em;\n    }\n    a:link, a:visited {\n        color: #38488f;\n        text-decoration: none;\n   
 }\n    @media (max-width: 700px) {\n        body {\n            background-color: #fff;\n        }\n        div {\n  
          width: auto;\n            margin: 0 auto;\n            border-radius: 0;\n            padding: 1em;\n        }\n  
  }\n    </style>    \n</head>\n\n<body>\n<div>\n    <h1>Example Domain</h1>\n    <p>This domain is 
established to be used for illustrative examples in documents. You may use this\n    domain in examples 
without prior coordination or asking for permission.</p>\n    <p><a 
href=\"http://www.iana.org/domains/example\">More information...</a>
</p>\n</div>\n</body>\n</html>\n"}

nil
iex(10)> 

Is this supported? Or am I doing something wrong here?

Thanks

@benoitc
Copy link
Owner

benoitc commented Aug 11, 2015

sounds like a bug. will try to reproduce it until tomorrow
On Tue 11 Aug 2015 at 19:36 cs-codesocial notifications@github.com wrote:

Erlang 18.0 / Elixir 1.0.5

:hackney.request(:get, "https://example.com", ["Connection":
"keep-alive"], [], [:async, insecure: true, proxy: "http://127.0.0.1:9001
"])

{:ok, #Reference<0.0.1.147>}

iex(9)>

19:22:50.971 [error] Unexpected message: {:ssl, {:sslsocket, {:gen_tcp, #Port<0.6604>, :tls_connection,
:undefined}, #PID<0.162.0>}, "HTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nCache-Control: max-
age=604800\r\nContent-Type: text/html\r\nDate: Tue, 11 Aug 2015 17:22:51 GMT\r\nEtag:
"359670651"\r\nExpires: Tue, 18 Aug 2015 17:22:51 GMT\r\nLast-Modified: Fri, 09 Aug 2013 23:54:35
GMT\r\nServer: ECS (iad/18CB)\r\nX-Cache: HIT\r\nx-ec-custom-error: 1\r\nContent-Length:
1270\r\n\r\n<!doctype html>\n\n\n <title>Example Domain</title>\n\n <meta
charset="utf-8" />\n <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, initial-scale=1" />\n <style
type="text/css">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;\n \n }\n div {\n
width: 600px;\n margin: 5em auto;\n padding: 50px;\n background-color: #fff;\n
border-radius: 1em;\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n
}\n @media (max-width: 700px) {\n body {\n background-color: #fff;\n }\n div {\n
width: auto;\n margin: 0 auto;\n border-radius: 0;\n padding: 1em;\n }\n
}\n </style> \n\n\n\n

\n

Example Domain

\n

This domain is
established to be used for illustrative examples in documents. You may use this\n domain in examples
without prior coordination or asking for permission.

\n

<a
href="http://www.iana.org/domains/example\">More information...

\n
\n\n\n"}

nil
iex(10)>

Is this supported? Or am I doing something wrong here?

Thanks


Reply to this email directly or view it on GitHub
#223.

@cs-codesocial
Copy link
Author

Hey benoitc, thanks for the quick response.
If it helps I've tested under OSX 0.10.3 as well as freebsd 10.1.
Don't have access to a linux box today, but I should be able to run a quick test tomorrow morning.

Thanks again.

@cs-codesocial
Copy link
Author

Same result on ubuntu lts using hackney master.

@benoitc
Copy link
Owner

benoitc commented Aug 13, 2015

what is the proxy used?

@cs-codesocial
Copy link
Author

Mitmproxy or any regular squidproxy setup.

@cs-codesocial
Copy link
Author

Hey benoitc, any updates on this?

@benoitc
Copy link
Owner

benoitc commented Aug 20, 2015

@cs-codesocial i will release hackney 1.3.2 tomorrow that should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants