Skip to content

Commit

Permalink
🐛 revert verifying if headers are ASCII or utf-8 encoded.
Browse files Browse the repository at this point in the history
We need a better solution to answer that particular problem.
  • Loading branch information
Ousret committed Mar 22, 2020
1 parent f9a01a8 commit d20c4dc
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions kiss_headers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,24 +683,6 @@ def parse_it(raw_headers: Any) -> Headers:
buf: BytesIO = (
BytesIO(raw_headers) if not hasattr(raw_headers, "closed") else raw_headers
)

bytes_: bytes = buf.read()

try:
bytes_.decode("ascii")
except UnicodeDecodeError:
try:
bytes_.decode("utf-8")
except UnicodeDecodeError:
raise UnicodeDecodeError(
"utf-8",
bytes_,
0,
len(bytes_),
"You intended to parse headers that are neither from ASCII encoding or UTF-8.",
)

buf.seek(0)
headers = BytesHeaderParser().parse(buf, headersonly=True).items()
elif isinstance(raw_headers, Mapping):
headers = raw_headers.items()
Expand Down

0 comments on commit d20c4dc

Please sign in to comment.