diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-21 01:16:35 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-21 01:16:35 -0700 |
commit | 6ffeaaebed0ac248b5ba1f60c6add44eb6e98004 (patch) | |
tree | 60900f6ea943125258dfb723b971ffe47726a19d /netlib | |
parent | 8a3a21bba1e6706295cc22e1b3a876a7a86cb705 (diff) | |
parent | c090e02848e0b0b34021ca72f0fc0d39be4de0d0 (diff) | |
download | mitmproxy-6ffeaaebed0ac248b5ba1f60c6add44eb6e98004.tar.gz mitmproxy-6ffeaaebed0ac248b5ba1f60c6add44eb6e98004.tar.bz2 mitmproxy-6ffeaaebed0ac248b5ba1f60c6add44eb6e98004.zip |
Merge branch 'master' of https://github.com/mitmproxy/mitmproxy
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/netlib/utils.py b/netlib/utils.py index 9eebf22c..0deb7c82 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -82,7 +82,7 @@ _label_valid = re.compile(b"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE) def is_valid_host(host): # type: (bytes) -> bool """ - Checks if a hostname is valid. + Checks if a hostname is valid. """ try: host.decode("idna") @@ -90,7 +90,7 @@ def is_valid_host(host): return False if len(host) > 255: return False - if host[-1] == b".": + if host and host[-1:] == b".": host = host[:-1] return all(_label_valid.match(x) for x in host.split(b".")) |