diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index fd9c36150eb..d05574cb998 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -94,7 +94,6 @@ class urlopen_FileTests(unittest.TestCase): for line in self.returned_obj.__iter__(): self.assertEqual(line, self.text) - class ProxyTests(unittest.TestCase): def setUp(self): @@ -592,6 +591,11 @@ class URLopener_Tests(unittest.TestCase): self.assertEqual(DummyURLopener().open( 'spam://example/ /'),'//example/%20/') + # test the safe characters are not quoted by urlopen + self.assertEqual(DummyURLopener().open( + "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"), + "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/") + # Just commented them out. # Can't really tell why keep failing in windows and sparc. diff --git a/Lib/urllib.py b/Lib/urllib.py index 03f6f5a3232..2fdf927f0ad 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -177,7 +177,7 @@ class URLopener: fullurl = unwrap(toBytes(fullurl)) # percent encode url. fixing lame server errors like space within url # parts - fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]") + fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|") if self.tempcache and fullurl in self.tempcache: filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb')