Nikolaus Rath added the comment:

Ok, this is a bit of a mess.

Issue #11448 contains a patch for the documentation. But the functionality 
itself is still not working.

With the (I believe) intended usage, we have:

>>> import http.client
>>> conn = http.client.HTTPSConnection("localhost",8080)
>>> conn.set_tunnel("www.python.org")
>>> conn.request("HEAD","/index.html")

What happens then is this:

- request() calls _send_request(), which calls _put_request()
- _put_request() generates a "Host: localhost:8080" header
- _send_request() calls sendheaders(), calls _send_output()
- _send_output() calls send(), which calls connect()
- connect() connects to localhost:8080 and calls _tunnel()
- _tunnel() sets self.host to www.python.org and establishes the tunnel, but 
the Host: header has already been generated, and the proxy host name and port 
is now lost
- The request is send with a wrong Host header
- When calling close() and connect(), connect will now try to connect directly 
to www.python.org, but attempt to use it as a proxy to tunnel to itself.

----------
nosy: +Nikratio
title: httplib.py: ._tunnel() broken -> http.client.HTTPConnection tunneling is 
broken
versions: +Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7776>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to