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
4715ca56
Commit
4715ca56
authored
May 24, 2012
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Plain Diff
Issue #14036: return None when port in urlparse cross 65535
parents
b95c6341
2fc5a508
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
Lib/test/test_urlparse.py
Lib/test/test_urlparse.py
+5
-0
Lib/urllib/parse.py
Lib/urllib/parse.py
+3
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urlparse.py
View file @
4715ca56
...
...
@@ -524,6 +524,11 @@ class UrlParseTestCase(unittest.TestCase):
self
.
assertEqual
(
p
.
port
,
80
)
self
.
assertEqual
(
p
.
geturl
(),
url
)
# Verify an illegal port is returned as None
url
=
b"HTTP://WWW.PYTHON.ORG:65536/doc/#frag"
p
=
urllib
.
parse
.
urlsplit
(
url
)
self
.
assertEqual
(
p
.
port
,
None
)
def
test_attributes_bad_port
(
self
):
"""Check handling of non-integer ports."""
p
=
urllib
.
parse
.
urlsplit
(
"http://www.example.net:foo"
)
...
...
Lib/urllib/parse.py
View file @
4715ca56
...
...
@@ -143,6 +143,9 @@ class _NetlocResultMixinBase(object):
port
=
self
.
_hostinfo
[
1
]
if
port
is
not
None
:
port
=
int
(
port
,
10
)
# Return None on an illegal port
if
not
(
0
<=
port
<=
65535
):
return
None
return
port
...
...
Misc/NEWS
View file @
4715ca56
...
...
@@ -42,6 +42,9 @@ Core and Builtins
Library
-------
- Issue #14036: Add an additional check to validate that port in urlparse does
not go in illegal range and returns None.
- Issue #14862: Add missing names to os.__all__
- Issue #14875: Use float('
inf
') instead of float('
1e66666
') in the json module.
...
...
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