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
Host header not being set for CONNECT method of HTTPS proxy #5011
Comments
@kenneth-reitz Do you happen to have a rough idea of how much effort would be involved in supporting this feature? |
I am also having huge problem with this as well. All of our proxies require at least HTTP/1.1 👎 Requests tries to connect using HTTP/1.0 and fails with: RemoteDisconnected('Remote end closed connection without response') I tried patch client _tunnel function to send 1.1 header and Host, the same way CURL sends, but I am getting Invalid response afterwards on: response = self.response_class(self.sock, method=self._method) probably lot more changes are needed on tunneling https requests... By the way http requests work normally. |
I don't believe this is a bug or feature in requests. Rather, we rely on underlying libraries to generate the appropriate Host header and HTTP version. I know urllib3 just added support for TLS-in-TLS (using TLS to connect to a TLS proxy and sending a TLS request over that). Perhaps things have become better and this is maybe fixed (or at least partially better). |
Yeah, this is part of client.py: https://raw.githubusercontent.com/python/cpython/master/Lib/http/client.py but unfortunately that didn't solve the issue. |
(Btw urllib3 TLS+TLS support hasn't been merged or released yet, still in development) |
Thanks sethmlarson, I just tested urllib3 branch, and TLS+TLS works perfectly! Thanks for the tip! https://github.com/jalopezsilva/urllib3/tree/tls_in_tls_integration |
Since
http.client
only supports HTTP 1.0 for the CONNECT method it's not required to send theHost
header. Unfortunately, HTTPS proxies often expect aHost
header to be present, and fail to connect in its absence. I thought this might be of some interest here sincerequests
+ proxies is not particularly uncommon.Is this something that could be supported in
requests
?Expected Result
The expectation is that
requests
will include theHost
header as part of the CONNECTion process.Actual Result
The
Host
header is not included.Reproduction Steps
System Information
The text was updated successfully, but these errors were encountered: