Author martin.panter
Recipients martin.panter, thomas.belhalfaoui
Date 2015-08-30.23:05:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440975915.32.0.677944435771.issue24964@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-08-30 23:05:15martin.pantersetrecipients: + martin.panter, thomas.belhalfaoui
2015-08-30 23:05:15martin.pantersetmessageid: <1440975915.32.0.677944435771.issue24964@psf.upfronthosting.co.za>
2015-08-30 23:05:15martin.panterlinkissue24964 messages
2015-08-30 23:05:14martin.pantercreate