Martin Panter added the comment:
Such a change would involve adding a new API, so should go into a new version
of Python.
Thomas: a diff rather than a full copy of the changed file would be more
convenient. Also, if this gets accepted, test cases and documentation would be
needed.
It is also useful to get the header of an unsuccessful CONNECT response. For
example, see Issue 7291, where the Proxy-Authenticate header of the proxy’s 407
response needs to be accessible. In that issue, I started working on a patch
tht may also be useful here. From memory, usage would be a bit like this:
proxy_conn = HTTPConnection("proxy")
proxy_conn.request("CONNECT", "website:443")
proxy_resp = proxy_conn.getresponse()
if proxy_resp.status == PROXY_AUTHENTICATION_REQUIRED:
# Handle proxy_resp.msg["Proxy-Authenticate"]
...
# Handle proxy_resp.msg["X-ProxyMesh-IP"]
...
tunnel = proxy_conn.detach() # Returns socket and any buffered data
website_conn = HTTPSConnection("website", tunnel=tunnel)
website_conn.request("GET", "/")
...
website_conn.close()
Thomas, let me know if this would be useful for you, and I can try and dig up
my patch.
----------
nosy: +martin.panter
versions: -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24964>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com