Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
eaaec27b
Commit
eaaec27b
authored
Mar 30, 2009
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for Issue4962, issue4675.
parent
7f6b4f86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
Lib/test/test_urllib.py
Lib/test/test_urllib.py
+16
-0
Lib/test/test_urlparse.py
Lib/test/test_urlparse.py
+3
-0
Lib/urllib/parse.py
Lib/urllib/parse.py
+2
-2
No files found.
Lib/test/test_urllib.py
View file @
eaaec27b
...
...
@@ -830,6 +830,21 @@ 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 password examples are not sensible, but it is added to
confirming to RFC2617 and addressing issue4675.
"""
self.assertEqual(('
user
', '
ab
'),urllib.parse.splitpasswd('
user
:
ab
'))
self.assertEqual(('
user
', '
a
\
nb
'),urllib.parse.splitpasswd('
user
:
a
\
nb
'))
self.assertEqual(('
user
', '
a
\
tb
'),urllib.parse.splitpasswd('
user
:
a
\
tb
'))
self.assertEqual(('
user
', '
a
\
rb'),urllib.parse.splitpasswd('
user
:
a
\
rb'))
self.assertEqual(('
user
', '
a
\
fb'),urllib.parse.splitpasswd('
user
:
a
\
fb'))
self.assertEqual(('
user
', '
a
\
vb
'),urllib.parse.splitpasswd('
user
:
a
\
vb
'))
self.assertEqual(('
user
', '
a
:
b'),urllib.parse.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
...
...
@@ -920,6 +935,7 @@ def test_main():
UnquotingTests
,
urlencode_Tests
,
Pathname_Tests
,
Utility_Tests
,
#FTPWrapperTests,
)
...
...
Lib/test/test_urlparse.py
View file @
eaaec27b
...
...
@@ -97,6 +97,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/'
,
''
,
''
,
''
),
...
...
Lib/urllib/parse.py
View file @
eaaec27b
...
...
@@ -19,7 +19,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'
,
...
...
@@ -645,7 +645,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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment