aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'netlib/http.py')
-rw-r--r--netlib/http.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/netlib/http.py b/netlib/http.py
index 1b03d330..5628dd4d 100644
--- a/netlib/http.py
+++ b/netlib/http.py
@@ -17,7 +17,7 @@ def parse_url(url):
Returns a (scheme, host, port, path) tuple, or None on error.
Checks that:
- port is an integer
+ port is an integer 0-65535
host is a valid IDNA-encoded hostname with no null-bytes
path is valid ASCII
"""
@@ -49,6 +49,8 @@ def parse_url(url):
path.decode("ascii")
except ValueError:
return None
+ if not 0 <= port <= 65535:
+ return None
return scheme, host, port, path