]> granicus.if.org Git - python/commitdiff
Merged revisions 78268 via svnmerge from
authorSenthil Kumaran <orsenthil@gmail.com>
Sat, 20 Feb 2010 22:19:04 +0000 (22:19 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Sat, 20 Feb 2010 22:19:04 +0000 (22:19 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

Lib/test/test_urllib.py
Lib/urllib/request.py

index 02d08d4445f2af18ee1a414582487fa5d6bbdca7..597678d0f8086cef0cfb98049701f4e36ba03011 100644 (file)
@@ -112,7 +112,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):
@@ -866,6 +865,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.
 # Everywhere else they work ok, but on those machines, someteimes
index 9332aa5dc0d01369c27cf25b2f607a2af6dc9225..07a7ee6960f869d3027487df75f6b11e3e495632 100644 (file)
@@ -1426,7 +1426,7 @@ class URLopener:
     def open(self, fullurl, data=None):
         """Use URLopener().open(file) instead of open(file, 'r')."""
         fullurl = unwrap(to_bytes(fullurl))
-        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')