[docs] [issue28389] xmlrpc.client HTTP proxy example code does not work
Attila Vangel
report at bugs.python.org
Sun Oct 9 13:47:26 EDT 2016
Attila Vangel added the comment:
Thanks for fixing this issue. I checked the changed documentation online, and I came up with a very similar solution. One difference is that although this example overrides the make_connection() method, but omits the following lines which are present in the xmlrpc.client.Transport code (I checked that in python 3.5.3):
# return an existing connection if possible. This allows
# HTTP/1.1 keep-alive.
if self._connection and host == self._connection[0]:
return self._connection[1]
# create a HTTP connection object from a host descriptor
chost, self._extra_headers, x509 = self.get_host_info(host)
Please check xmlrpc.client.Transport.make_connection().
I am not sure about the what kind of effect this may have.
I used chost as the parameter of set_tunnel(), rather than host (after briefly checking the code how it is calculated I felt that it's better to use chost than host, but I don't have a deep understanding of the http.client code).
The proxy_headers is a new thing, I guess it's a good thing if someone needs that.
I don't understand why the '*' character is needed in
connection = http.client.HTTPConnection(*self.proxy)
However I'm quite new to python.
I will try this new code tomorrow.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28389>
_______________________________________
More information about the docs
mailing list