[Python-checkins] r78268 - in python/trunk/Lib: test/test_urllib.py urllib.py
senthil.kumaran
python-checkins at python.org
Sat Feb 20 23:05:34 CET 2010
Author: senthil.kumaran
Date: Sat Feb 20 23:05:34 2010
New Revision: 78268
Log:
Fix for Issue7751: urllib.urlopen("///C|/foo/bar/spam.foo")
Modified:
python/trunk/Lib/test/test_urllib.py
python/trunk/Lib/urllib.py
Modified: python/trunk/Lib/test/test_urllib.py
==============================================================================
--- python/trunk/Lib/test/test_urllib.py (original)
+++ python/trunk/Lib/test/test_urllib.py Sat Feb 20 23:05:34 2010
@@ -93,7 +93,6 @@
for line in self.returned_obj.__iter__():
self.assertEqual(line, self.text)
-
class ProxyTests(unittest.TestCase):
def setUp(self):
@@ -607,6 +606,11 @@
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.
Modified: python/trunk/Lib/urllib.py
==============================================================================
--- python/trunk/Lib/urllib.py (original)
+++ python/trunk/Lib/urllib.py Sat Feb 20 23:05:34 2010
@@ -179,7 +179,7 @@
fullurl = unwrap(toBytes(fullurl))
# percent encode url, fixing lame server errors for e.g, like space
# within url paths.
- 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')
More information about the Python-checkins
mailing list