masperro / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

Proxy doesn't work #113

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Proxy doesn't work if my local DNS server doesn't know hostname. For example, I 
need connect to http://api.intranet.dev/mailapi.php. However, intranet.dev is 
fake domain, it's doesn't exist in DNS, so I have to use proxy server 
192.168.1.50:8000:

import httplib2
proxy_info = httplib2.ProxyInfo(
    proxy_type = httplib2.socks.PROXY_TYPE_HTTP,
    proxy_host = '192.168.1.50',
    proxy_port = 8000,
    proxy_rdns = True
)
h = httplib2.Http(proxy_info = proxy_info)
r, c = h.request('http://api.intranet.dev/mailapi.php')

It doesn't work:

ServerNotFoundError: Unable to find the server at api.intranet.dev

Problem is in the HTTPConnectionWithTimeout.connect(). There is:

for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):

In my example socket.getaddrinfo can't reverse self.host. There is patch which 
solve this problem. However, only in python2 subtree, because I haven't used 
Python 3.

Original issue reported on code.google.com by jan.seif...@fotkyzcest.net on 17 Sep 2010 at 12:35

Attachments:

GoogleCodeExporter commented 8 years ago
socks.py has been updated to latest.

Original comment by joe.gregorio@gmail.com on 13 Jun 2011 at 5:33

GoogleCodeExporter commented 8 years ago
socks.py has been updated to latest.

Original comment by joe.gregorio@gmail.com on 13 Jun 2011 at 5:33

GoogleCodeExporter commented 8 years ago
It doesn't look like this patch has been applied? Has it been fixed in some 
other way?

Original comment by hrydg...@gmail.com on 21 Nov 2011 at 12:56

GoogleCodeExporter commented 8 years ago
Hi it seems the patch is not applied in HttpLib2-0.7.4-py2.7.
I make it working applying manually the content of proxy.patch provided in the 
first post to the current version of HttpLib2.

Original comment by thomas.b...@gmail.com on 26 Apr 2012 at 11:47

Attachments: