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
Use of set_tunnel with default port results in incorrect post value in host header #66293
Comments
Creating this bug for clarity, but was encountered while investigating 22041 (now set as not a bug). When using set_tunnel with default port, the port value in the host header is set to "None": "send: b'POST [PATH] HTTP/1.1\r\nHost: [HOST]:None\r\nAccept-Encoding: identity\r\nContent-Length: 41\r\nAccept: text/plain\r\nContent-type: application/x-www-form-urlencoded\r\n\r\n[FORM_DATA]'" This issue seems to have been introduced in 3.4 when _tunnel_host and _tunnel_port were introduced to decouple the destination host and port from the proxy host and port. |
Bump for review |
If call _get_hostport() in set_tunnel() then it should be removed in _tunnel(). As for tests, it would be better do not rely on implementation details. Instead you can monkey-patch the send() method of of HTTPConnection instance and check passed argument. |
Thanks Serhiy, new patch addresses your comments. |
See also comments on Rietveld (e-mail notification likely fell in spam). |
Thanks for the ping Serhiy, indeed the review notification email was sitting in spam. New patch addressing review comments as well as rectifying my own silliness. |
New changeset 676d6bcfc031 by Serhiy Storchaka in branch '3.4': New changeset ebe2072e5472 by Serhiy Storchaka in branch 'default': |
Thank you for your contribution Demian. |
New changeset 3b6e0720a69d by Serhiy Storchaka in branch '2.7': |
Backported to 2.7 because this is needed to support proxy with a port in urllib/urllib2 as documented. See bpo-24311. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: