Small fix

This commit is contained in:
Akshay Sharma 2021-08-02 14:26:54 +05:30
parent 57d76df85c
commit 841a218431
1 changed files with 2 additions and 2 deletions

View File

@ -163,15 +163,15 @@ class ResponseTypes:
if not body:
body = b''
body = body[:RESOURCE_HEADER_BUFFER_LENGTH]
contains_binary_bytes = False
for index in range(len(body)):
if body[index:index + 1] != b"\x00" and contains_binary(body[index:index + 1]):
contains_binary_bytes = True
break
if not contains_binary_bytes:
body = body[:RESOURCE_HEADER_BUFFER_LENGTH].replace(b"\x00", b"")
body = body.replace(b"\x00", b"")
cls = Response
http_origin = not url or urlparse(url).scheme in ("http", "https")