diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2009-03-30 21:51:50 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2009-03-30 21:51:50 (GMT) |
commit | 5e95e763e1ba51b9bd4153aa016099e183b05434 (patch) | |
tree | 7014625e7ad52f519804a78ee29588ab04711981 | |
parent | e7c9e092b3d339718b0794f6a593a5032b6b9fb5 (diff) | |
download | cpython-5e95e763e1ba51b9bd4153aa016099e183b05434.zip cpython-5e95e763e1ba51b9bd4153aa016099e183b05434.tar.gz cpython-5e95e763e1ba51b9bd4153aa016099e183b05434.tar.bz2 |
Fix for bugs: Issue4675 and Issue4962.
-rw-r--r-- | Lib/test/test_urllib.py | 17 | ||||
-rw-r--r-- | Lib/test/test_urlparse.py | 3 | ||||
-rw-r--r-- | Lib/urllib.py | 2 | ||||
-rw-r--r-- | Lib/urlparse.py | 2 |
4 files changed, 22 insertions, 2 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index c519578..93921a6 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -582,6 +582,22 @@ class Pathname_Tests(unittest.TestCase): "url2pathname() failed; %s != %s" % (expect, result)) +class Utility_Tests(unittest.TestCase): + """Testcase to test the various utility functions in the urllib.""" + + def test_splitpasswd(self): + """Some of the password examples are not sensible, but it is added to + confirming to RFC2617 and addressing issue4675. + """ + self.assertEqual(('user', 'ab'),urllib.splitpasswd('user:ab')) + self.assertEqual(('user', 'a\nb'),urllib.splitpasswd('user:a\nb')) + self.assertEqual(('user', 'a\tb'),urllib.splitpasswd('user:a\tb')) + self.assertEqual(('user', 'a\rb'),urllib.splitpasswd('user:a\rb')) + self.assertEqual(('user', 'a\fb'),urllib.splitpasswd('user:a\fb')) + self.assertEqual(('user', 'a\vb'),urllib.splitpasswd('user:a\vb')) + self.assertEqual(('user', 'a:b'),urllib.splitpasswd('user:a:b')) + + # 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 @@ -676,6 +692,7 @@ def test_main(): UnquotingTests, urlencode_Tests, Pathname_Tests, + Utility_Tests, #FTPWrapperTests, ) diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index fcd1989..e7a8317 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -96,6 +96,9 @@ class UrlParseTestCase(unittest.TestCase): '', '', ''), ('mms', 'wms.sys.hinet.net', '/cts/Drama/09006251100.asf', '', '')), + ('nfs://server/path/to/file.txt', + ('nfs', 'server', '/path/to/file.txt', '', '', ''), + ('nfs', 'server', '/path/to/file.txt', '', '')), ('svn+ssh://svn.zope.org/repos/main/ZConfig/trunk/', ('svn+ssh', 'svn.zope.org', '/repos/main/ZConfig/trunk/', '', '', ''), diff --git a/Lib/urllib.py b/Lib/urllib.py index 0594dc8..1ac997e 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -1073,7 +1073,7 @@ def splitpasswd(user): global _passwdprog if _passwdprog is None: import re - _passwdprog = re.compile('^([^:]*):(.*)$') + _passwdprog = re.compile('^([^:]*):(.*)$',re.S) match = _passwdprog.match(user) if match: return match.group(1, 2) diff --git a/Lib/urlparse.py b/Lib/urlparse.py index c56d883..5e5d37d 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -14,7 +14,7 @@ uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '', - 'svn', 'svn+ssh', 'sftp'] + 'svn', 'svn+ssh', 'sftp','nfs'] non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', |