[Python-checkins] r78269 - in python/branches/release26-maint: Lib/test/test_urllib.py Lib/urllib.py

senthil.kumaran python-checkins at python.org
Sat Feb 20 23:13:02 CET 2010


Author: senthil.kumaran
Date: Sat Feb 20 23:13:01 2010
New Revision: 78269

Log:
Merged revisions 78268 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78268 | senthil.kumaran | 2010-02-21 03:35:34 +0530 (Sun, 21 Feb 2010) | 3 lines
  
  Fix for Issue7751: urllib.urlopen("///C|/foo/bar/spam.foo")
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/test/test_urllib.py
   python/branches/release26-maint/Lib/urllib.py

Modified: python/branches/release26-maint/Lib/test/test_urllib.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_urllib.py	(original)
+++ python/branches/release26-maint/Lib/test/test_urllib.py	Sat Feb 20 23:13:01 2010
@@ -94,7 +94,6 @@
         for line in self.returned_obj.__iter__():
             self.assertEqual(line, self.text)
 
-
 class ProxyTests(unittest.TestCase):
 
     def setUp(self):
@@ -592,6 +591,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/branches/release26-maint/Lib/urllib.py
==============================================================================
--- python/branches/release26-maint/Lib/urllib.py	(original)
+++ python/branches/release26-maint/Lib/urllib.py	Sat Feb 20 23:13:01 2010
@@ -177,7 +177,7 @@
         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')


More information about the Python-checkins mailing list