[Python-checkins] r43553 - in python/trunk/Lib: test/test_urllib2.py urllib2.py (original) (raw)

georg.brandl python-checkins at python.org
Sun Apr 2 22:45:35 CEST 2006


Author: georg.brandl Date: Sun Apr 2 22:45:34 2006 New Revision: 43553

Modified: python/trunk/Lib/test/test_urllib2.py python/trunk/Lib/urllib2.py Log: Patch #1462790: fix urllib2 ProxyHandler for host:port proxies

Modified: python/trunk/Lib/test/test_urllib2.py

--- python/trunk/Lib/test/test_urllib2.py (original) +++ python/trunk/Lib/test/test_urllib2.py Sun Apr 2 22:45:34 2006 @@ -13,8 +13,7 @@

parse_keqv_list, parse_http_list (I'm leaving this for Anthony Baxter

and Greg Stein, since they're doing Digest Authentication)

Authentication stuff (ditto)

-# ProxyHandler, CustomProxy, CustomProxyHandler (I don't use a proxy) -# GopherHandler (haven't used gopher for a decade or so...) +# CustomProxy, CustomProxyHandler

class TrivialTests(unittest.TestCase): def test_trivial(self): @@ -90,6 +89,7 @@ return self.handle(self.meth_name, self.action, *args)

class MockHandler:

@@ -642,6 +642,23 @@ o.open("http://www.example.com/") self.assert_(not hh.req.has_header("Cookie"))

class MiscTests(unittest.TestCase):

@@ -827,6 +844,7 @@

def test_main(verbose=None):

Modified: python/trunk/Lib/urllib2.py

--- python/trunk/Lib/urllib2.py (original) +++ python/trunk/Lib/urllib2.py Sun Apr 2 22:45:34 2006 @@ -119,7 +119,8 @@

support for FileHandler, proxies via environment variables

from urllib import localhost, url2pathname, getproxies

-version = "2.5" +# used in User-Agent header sent +version = sys.version[:3]

_opener = None def urlopen(url, data=None): @@ -563,6 +564,80 @@ "lead to an infinite loop.\n"
"The last 30x error message was:\n"

@@ -579,30 +654,25 @@

 def proxy_open(self, req, proxy, type):
     orig_type = req.get_type()

feature suggested by Duncan Booth



More information about the Python-checkins mailing list