summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-11-18 15:36:41 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-11-18 15:36:41 (GMT)
commitdaa29d01b749daa4843bcac80bd0067a827cfb8a (patch)
tree17725f0e7801121e5308a09b14d45d2b71bebb98 /Lib/test/test_urllib2.py
parentd8b661dd908629b5fc0f50e3e0c5fc5c85f9cb72 (diff)
downloadcpython-daa29d01b749daa4843bcac80bd0067a827cfb8a.zip
cpython-daa29d01b749daa4843bcac80bd0067a827cfb8a.tar.gz
cpython-daa29d01b749daa4843bcac80bd0067a827cfb8a.tar.bz2
Fix Issue2244 - urllib unquotes user and password info multiple times - Patch by Theodore Turocy
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 8d59180..e5e3c39 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -631,22 +631,32 @@ class HandlerTests(unittest.TestCase):
h = NullFTPHandler(data)
o = h.parent = MockOpener()
- for url, host, port, type_, dirs, filename, mimetype in [
+ for url, host, port, user, passwd, type_, dirs, filename, mimetype in [
("ftp://localhost/foo/bar/baz.html",
- "localhost", ftplib.FTP_PORT, "I",
+ "localhost", ftplib.FTP_PORT, "", "", "I",
+ ["foo", "bar"], "baz.html", "text/html"),
+ ("ftp://parrot@localhost/foo/bar/baz.html",
+ "localhost", ftplib.FTP_PORT, "parrot", "", "I",
+ ["foo", "bar"], "baz.html", "text/html"),
+ ("ftp://%25parrot@localhost/foo/bar/baz.html",
+ "localhost", ftplib.FTP_PORT, "%parrot", "", "I",
+ ["foo", "bar"], "baz.html", "text/html"),
+ ("ftp://%2542parrot@localhost/foo/bar/baz.html",
+ "localhost", ftplib.FTP_PORT, "%42parrot", "", "I",
["foo", "bar"], "baz.html", "text/html"),
("ftp://localhost:80/foo/bar/",
- "localhost", 80, "D",
+ "localhost", 80, "", "", "D",
["foo", "bar"], "", None),
("ftp://localhost/baz.gif;type=a",
- "localhost", ftplib.FTP_PORT, "A",
+ "localhost", ftplib.FTP_PORT, "", "", "A",
[], "baz.gif", None), # XXX really this should guess image/gif
]:
req = Request(url)
req.timeout = None
r = h.ftp_open(req)
# ftp authentication not yet implemented by FTPHandler
- self.assertTrue(h.user == h.passwd == "")
+ self.assertEqual(h.user, user)
+ self.assertEqual(h.passwd, passwd)
self.assertEqual(h.host, socket.gethostbyname(host))
self.assertEqual(h.port, port)
self.assertEqual(h.dirs, dirs)