Index: Lib/urllib.py =================================================================== --- Lib/urllib.py (revision 70723) +++ Lib/urllib.py (working copy) @@ -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) Index: Lib/test/test_urllib.py =================================================================== --- Lib/test/test_urllib.py (revision 70723) +++ Lib/test/test_urllib.py (working copy) @@ -582,6 +582,22 @@ "url2pathname() failed; %s != %s" % (expect, result)) +class Utility_Tests(unittest.TestCase): + """Testcase to tests the various utility functions in the urllib. + Some of the esoteric passwords tested are not sensible, but it has been + added confirming the requirements in RFC2617 and addressing issue4675. + """ + + def test_splitpasswd(self): + 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, )