[New-bugs-announce] [issue11375] urllib2 over SOCKS doesn't use proxy for DNS

OJW report at bugs.python.org
Wed Mar 2 15:51:48 CET 2011

New submission from OJW <owhite at yahoo.com>:

import socks
import socket

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, "", 9050, True)
socket.socket = socks.socksocket

import urllib2
print urllib2.urlopen("http://example.com/").read()

Expected result: all network communications go through SOCKS4A proxy

Actual result: DNS lookup of example.com goes through default gateway, followed by HTTP connection via the proxy

components: Library (Lib)
messages: 129899
nosy: OJW
priority: normal
severity: normal
status: open
title: urllib2 over SOCKS doesn't use proxy for DNS
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list