[Python-checkins] r70757 - in python/trunk/Lib: test/test_urllib.py test/test_urlparse.py urllib.py urlparse.py

senthil.kumaran python-checkins at python.org
Mon Mar 30 23:51:50 CEST 2009


Author: senthil.kumaran
Date: Mon Mar 30 23:51:50 2009
New Revision: 70757
Log:
Fix for bugs: Issue4675 and Issue4962.
Modified:
 python/trunk/Lib/test/test_urllib.py
 python/trunk/Lib/test/test_urlparse.py
 python/trunk/Lib/urllib.py
 python/trunk/Lib/urlparse.py
Modified: python/trunk/Lib/test/test_urllib.py
==============================================================================
--- python/trunk/Lib/test/test_urllib.py	(original)
+++ python/trunk/Lib/test/test_urllib.py	Mon Mar 30 23:51:50 2009
@@ -582,6 +582,22 @@
 "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 @@
 UnquotingTests,
 urlencode_Tests,
 Pathname_Tests,
+ Utility_Tests,
 #FTPWrapperTests,
 )
 
Modified: python/trunk/Lib/test/test_urlparse.py
==============================================================================
--- python/trunk/Lib/test/test_urlparse.py	(original)
+++ python/trunk/Lib/test/test_urlparse.py	Mon Mar 30 23:51:50 2009
@@ -96,6 +96,9 @@
 '', '', ''),
 ('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/',
 '', '', ''),
Modified: python/trunk/Lib/urllib.py
==============================================================================
--- python/trunk/Lib/urllib.py	(original)
+++ python/trunk/Lib/urllib.py	Mon Mar 30 23:51:50 2009
@@ -1073,7 +1073,7 @@
 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)
Modified: python/trunk/Lib/urlparse.py
==============================================================================
--- python/trunk/Lib/urlparse.py	(original)
+++ python/trunk/Lib/urlparse.py	Mon Mar 30 23:51:50 2009
@@ -14,7 +14,7 @@
 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',


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /