cpython: 4b98961748f1 (original) (raw)

Mercurial > cpython

changeset 91755:4b98961748f1 3.4

Fix localhost checking in FileHandler. Raised in #21970. [#21970]

Senthil Kumaran senthil@uthcode.com
date Tue, 22 Jul 2014 00:15:20 -0700
parents 4dac45f88d45
children 2c660948bb41 a74c48aa43eb
files Lib/test/test_urllib2.py Lib/urllib/request.py
diffstat 2 files changed, 3 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_urllib2.py 3 Lib/urllib/request.py 2

line wrap: on

line diff

--- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -678,7 +678,7 @@ class HandlerTests(unittest.TestCase): self.assertEqual(int(headers["Content-length"]), len(data)) def test_file(self):

@@ -725,6 +725,7 @@ class HandlerTests(unittest.TestCase): for url in [ "file://localhost:80%s" % urlpath, "file:///file_does_not_exist.txt",

--- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1315,7 +1315,7 @@ class FileHandler(BaseHandler): url = req.selector if url[:2] == '//' and url[2:3] != '/' and (req.host and req.host != 'localhost'):