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
bd3e771a
Commit
bd3e771a
authored
Mar 18, 2002
by
Michael W. Hudson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amk's fix attached to
[ 516299 ] urlparse can get fragments wrong
parent
5c137c22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
Lib/test/output/test_urlparse
Lib/test/output/test_urlparse
+5
-0
Lib/test/test_urlparse.py
Lib/test/test_urlparse.py
+18
-0
Lib/urlparse.py
Lib/urlparse.py
+3
-1
No files found.
Lib/test/output/test_urlparse
View file @
bd3e771a
test_urlparse
test_urlparse
http://www.python.org = ('http', 'www.python.org', '', '', '', '')
http://www.python.org#abc = ('http', 'www.python.org', '', '', '', 'abc')
http://www.python.org/#abc = ('http', 'www.python.org', '/', '', '', 'abc')
http://a/b/c/d;p?q#f = ('http', 'a', '/b/c/d', 'p', 'q', 'f')
urlparse.urljoin() tests
urlparse.urljoin() tests
g:h = 'g:h'
g:h = 'g:h'
...
...
Lib/test/test_urlparse.py
View file @
bd3e771a
...
@@ -4,6 +4,24 @@ errors = 0
...
@@ -4,6 +4,24 @@ errors = 0
RFC1808_BASE
=
"http://a/b/c/d;p?q#f"
RFC1808_BASE
=
"http://a/b/c/d;p?q#f"
for
url
,
expected
in
[(
'http://www.python.org'
,
(
'http'
,
'www.python.org'
,
''
,
''
,
''
,
''
)),
(
'http://www.python.org#abc'
,
(
'http'
,
'www.python.org'
,
''
,
''
,
''
,
'abc'
)),
(
'http://www.python.org/#abc'
,
(
'http'
,
'www.python.org'
,
'/'
,
''
,
''
,
'abc'
)),
(
RFC1808_BASE
,
(
'http'
,
'a'
,
'/b/c/d'
,
'p'
,
'q'
,
'f'
)),
]:
result
=
urlparse
.
urlparse
(
url
)
print
"%-13s = %r"
%
(
url
,
result
)
if
result
!=
expected
:
errors
+=
1
print
"urlparse(%r)"
%
url
print
(
"expected %r,
\
n
"
" got %r"
)
%
(
expected
,
result
)
print
def
checkJoin
(
relurl
,
expected
):
def
checkJoin
(
relurl
,
expected
):
global
errors
global
errors
result
=
urlparse
.
urljoin
(
RFC1808_BASE
,
relurl
)
result
=
urlparse
.
urljoin
(
RFC1808_BASE
,
relurl
)
...
...
Lib/urlparse.py
View file @
bd3e771a
...
@@ -87,7 +87,9 @@ def urlsplit(url, scheme='', allow_fragments=1):
...
@@ -87,7 +87,9 @@ def urlsplit(url, scheme='', allow_fragments=1):
if
url
[:
2
]
==
'//'
:
if
url
[:
2
]
==
'//'
:
i
=
url
.
find
(
'/'
,
2
)
i
=
url
.
find
(
'/'
,
2
)
if
i
<
0
:
if
i
<
0
:
i
=
len
(
url
)
i
=
url
.
find
(
'#'
)
if
i
<
0
:
i
=
len
(
url
)
netloc
=
url
[
2
:
i
]
netloc
=
url
[
2
:
i
]
url
=
url
[
i
:]
url
=
url
[
i
:]
if
allow_fragments
and
'#'
in
url
:
if
allow_fragments
and
'#'
in
url
:
...
...
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