mirror of https://github.com/scrapy/scrapy.git
[HTTP/1.1] Skip Content-Length header if its value is UNKNOWN_LENGTH (#5062)
This commit is contained in:
parent
f0e1a33225
commit
9c9e1a318d
|
|
@ -361,10 +361,9 @@ class ScrapyAgent:
|
|||
@staticmethod
|
||||
def _headers_from_twisted_response(response):
|
||||
headers = Headers()
|
||||
if response.length is not None:
|
||||
if response.length != UNKNOWN_LENGTH:
|
||||
headers[b'Content-Length'] = str(response.length).encode()
|
||||
for key, value in response.headers.getAllRawHeaders():
|
||||
headers[key] = value
|
||||
headers.update(response.headers.getAllRawHeaders())
|
||||
return headers
|
||||
|
||||
def _cb_bodyready(self, txresponse, request):
|
||||
|
|
|
|||
Loading…
Reference in New Issue