[New-bugs-announce] [issue24964] Add tunnel CONNECT response headers to httplib / http.client

Thomas report at bugs.python.org
Sun Aug 30 19:41:50 CEST 2015


New submission from Thomas:

When using httplib / http.client to connect to an HTTPS website through a proxy (by making a tunnel with a CONNECT request), there is no way to retrieve the HTTP headers which the proxy sends back in response to that CONNECT request.

This becomes a problem when using rotating proxy providers like ProxyMesh, who send useful information in those headers (for instance, "X-ProxyMesh-IP" contains the IP address of the proxy, which is necessary to keep the same address throughout the session).

It would be nice to save those headers in a property of the HTTPConnection class (e.g. self._tunnel_response_headers), which would be set up inside the _tunnel method (as proposed in the attached patch, lines 748 and 827-831). This would allow to get the headers back and/or pass them to a higher-level library (such as requests).

----------
components: Library (Lib)
files: httplib.py
messages: 249361
nosy: Thomas
priority: normal
severity: normal
status: open
title: Add tunnel CONNECT response headers to httplib / http.client
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40301/httplib.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24964>
_______________________________________


More information about the New-bugs-announce mailing list