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
656b84d0
Commit
656b84d0
authored
May 24, 2012
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14036: return None when port in urlparse cross 65535
parent
985e24d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Lib/test/test_urlparse.py
Lib/test/test_urlparse.py
+5
-0
Lib/urlparse.py
Lib/urlparse.py
+5
-3
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urlparse.py
View file @
656b84d0
...
...
@@ -437,6 +437,11 @@ class UrlParseTestCase(unittest.TestCase):
self
.
assertEqual
(
p
.
port
,
80
)
self
.
assertEqual
(
p
.
geturl
(),
url
)
# Verify an illegal port of value greater than 65535 is set as None
url
=
"http://www.python.org:65536"
p
=
urlparse
.
urlsplit
(
url
)
self
.
assertEqual
(
p
.
port
,
None
)
def
test_issue14072
(
self
):
p1
=
urlparse
.
urlsplit
(
'tel:+31-641044153'
)
self
.
assertEqual
(
p1
.
scheme
,
'tel'
)
...
...
Lib/urlparse.py
View file @
656b84d0
...
...
@@ -97,9 +97,11 @@ class ResultMixin(object):
netloc
=
self
.
netloc
.
split
(
'@'
)[
-
1
].
split
(
']'
)[
-
1
]
if
':'
in
netloc
:
port
=
netloc
.
split
(
':'
)[
1
]
return
int
(
port
,
10
)
else
:
return
None
port
=
int
(
port
,
10
)
# verify legal port
if
(
0
<=
port
<=
65535
):
return
port
return
None
from
collections
import
namedtuple
...
...
Misc/NEWS
View file @
656b84d0
...
...
@@ -64,6 +64,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
#
14888
:
Fix
misbehaviour
of
the
_md5
module
when
called
on
data
larger
than
2
**
32
bytes
.
...
...
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