diff options
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/http/http1/read.py | 5 | ||||
-rw-r--r-- | netlib/utils.py | 5 |
2 files changed, 3 insertions, 7 deletions
diff --git a/netlib/http/http1/read.py b/netlib/http/http1/read.py index 4c898348..73c7deed 100644 --- a/netlib/http/http1/read.py +++ b/netlib/http/http1/read.py @@ -218,11 +218,6 @@ def _get_first_line(rfile): raise HttpReadDisconnect("Remote disconnected") if not line: raise HttpReadDisconnect("Remote disconnected") - line = line.strip() - try: - line.decode("ascii") - except ValueError: - raise HttpSyntaxException("Non-ascii characters in first line: {}".format(line)) return line.strip() diff --git a/netlib/utils.py b/netlib/utils.py index 6f6d1ea0..8b9548ed 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -237,8 +237,9 @@ def parse_url(url): if isinstance(url, six.binary_type): host = parsed.hostname - # this should not raise a ValueError - decode_parse_result(parsed, "ascii") + # this should not raise a ValueError, + # but we try to be very forgiving here and accept just everything. + # decode_parse_result(parsed, "ascii") else: host = parsed.hostname.encode("idna") parsed = encode_parse_result(parsed, "ascii") |