curl-and-python

Re: Resolve DNS via Proxy

From: Wim Lewis <wiml_at_omnigroup.com>
Date: Wed, 14 Nov 2012 19:11:31 -0800

On 14 Nov 2012, at 5:19 PM, Giacomo wrote:
> I'm pretty sure this topic has been talked about before but I can't find anything related to my question. So that is why I turn to you all.
> I'm working on a project where I want the possibility for traffic to go trough the Tor network. Sending my HTTP traffic through the proxy goes fine, but all my DNS requests are being bypassed. Now this is possibly expected behaviour, but I was wondering if PyCurl offers the possibility to also send DNS requests through the defined proxy.
> The current lines I use to define my proxy are:
>
> curl.setopt(curl.PROXY, "127.0.0.1:9050")
> curl.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)

I think you need to set PROXYTYPE to SOCKS5_HOSTNAME to make the proxy server do the name resolution.

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2012-11-15