New issue 113 by jan.seif...@fotkyzcest.net: Proxy doesn't work
http://code.google.com/p/httplib2/issues/detail?id=113
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.
Attachments:
proxy.patch 2.5 KB
socks.py has been updated to latest.
Comment #1 on issue 113 by joe.gregorio: Proxy doesn't work
http://code.google.com/p/httplib2/issues/detail?id=113
socks.py has been updated to latest.