Skip to content

Commit 789e5de

Browse files
committed
even faster and cleaner headers_raw_to_dict
1 parent 0db3f3f commit 789e5de

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

w3lib/http.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ def headers_raw_to_dict(headers_raw: bytes | None) -> HeadersDictOutput | None:
4949
if not headers_raw:
5050
return {}
5151

52-
headers = iter(BytesIO(headers_raw).readline, b"")
5352
result_dict: HeadersDictOutput = {}
5453

55-
for header in headers:
54+
for header in BytesIO(headers_raw):
5655
key, sep, value = header.partition(b":")
5756
if not sep:
5857
continue

0 commit comments

Comments
 (0)