diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-03-16 20:56:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-03-16 20:56:24 (GMT) |
commit | 2221f666eba4a6f46f2095a801bc3e4bdbdb97d2 (patch) | |
tree | 1a4501e649edfdbd13656e8ee21240eddf333861 /Doc/library | |
parent | 7bdf786e747e59ab47a3c45c0fd42c12cd7cb221 (diff) | |
parent | a48d9eaa5ccb3d8d0e224e78471bd660605116ec (diff) | |
download | cpython-2221f666eba4a6f46f2095a801bc3e4bdbdb97d2.zip cpython-2221f666eba4a6f46f2095a801bc3e4bdbdb97d2.tar.gz cpython-2221f666eba4a6f46f2095a801bc3e4bdbdb97d2.tar.bz2 |
merge 3.3 (#11448)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/http.client.rst | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index d4cdfd3..8ece400 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -451,11 +451,25 @@ HTTPConnection Objects .. method:: HTTPConnection.set_tunnel(host, port=None, headers=None) - Set the host and the port for HTTP Connect Tunnelling. Normally used when it - is required to a HTTPS Connection through a proxy server. + Set the host and the port for HTTP Connect Tunnelling. This allows running + the connection through a proxy server. - The headers argument should be a mapping of extra HTTP headers to send - with the CONNECT request. + The host and port arguments specify the endpoint of the tunneled connection + (i.e. the address included in the CONNECT request, *not* the address of the + proxy server). + + The headers argument should be a mapping of extra HTTP headers to send with + the CONNECT request. + + For example, to tunnel through a HTTPS proxy server running locally on port + 8080, we would pass the address of the proxy to the :class:`HTTPSConnection` + constructor, and the address of the host that we eventually want to reach to + the :meth:`~HTTPConnection.set_tunnel` method:: + + >>> import http.client + >>> conn = http.client.HTTPSConnection("localhost", 8080) + >>> conn.set_tunnel("www.python.org") + >>> conn.request("HEAD","/index.html") .. versionadded:: 3.2 |