This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author avangel
Recipients avangel, berker.peksag, docs@python
Date 2016-10-08.13:33:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1475933580.85.0.235195143592.issue28389@psf.upfronthosting.co.za>
In-reply-to
Content
Hi, thx for the quick turnaround.
I tried the proxy.py (on python 3.5) of course replacing 'YOUR_PROXY' with '10.144.1.11:8080' according to my environment.

python3 proxy.py 
Traceback (most recent call last):
  File "proxy.py", line 27, in <module>
    print(server.examples.getStateName(41))
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1092, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1432, in __request
    verbose=self.__verbose
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1134, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1147, in single_request
    resp = http_conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer


However, meanwhile I studied a bit the http.client API on how to use HTTP proxy, and I found set_tunnel() can do it. I had success by only overriding make_connection() in ProxiedTransport:
- copy current code of make_connection() from xmlrpc.client.Transport to ProxiedTransport (NOTE, this itself violates the DRY principle, but there is no better way to do it), change it slightly:
- create HTTPSConnection to the proxy (as I wanted to access a https URL)
- use .set_tunnel(chost) on this connection

I did not want to paste the code here, because
- I did not want to fill the 'PSF Contributor Agreement', at least yet
- it may be Python version specific solution.
History
Date User Action Args
2016-10-08 13:33:00avangelsetrecipients: + avangel, docs@python, berker.peksag
2016-10-08 13:33:00avangelsetmessageid: <1475933580.85.0.235195143592.issue28389@psf.upfronthosting.co.za>
2016-10-08 13:33:00avangellinkissue28389 messages
2016-10-08 13:33:00avangelcreate