diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2013-03-03 15:08:17 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2013-03-03 15:08:17 +1300 |
commit | 7b9300743e879a8a2e35f5786b23a17261350ff9 (patch) | |
tree | cb8553d292c44201f9afa0402e86648b70917481 /netlib/http.py | |
parent | cd4ed8530fa04fcbd54009e9db6ad9ea2518a10b (diff) | |
download | mitmproxy-7b9300743e879a8a2e35f5786b23a17261350ff9.tar.gz mitmproxy-7b9300743e879a8a2e35f5786b23a17261350ff9.tar.bz2 mitmproxy-7b9300743e879a8a2e35f5786b23a17261350ff9.zip |
More parse_url solidification: check that port is in range 0-65535
Diffstat (limited to 'netlib/http.py')
-rw-r--r-- | netlib/http.py | 4 |
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 |