未验证 提交 9c9e1a31 编写于 作者: E Eugenio Lacuesta 提交者: GitHub

[HTTP/1.1] Skip Content-Length header if its value is UNKNOWN_LENGTH (#5062)

上级 f0e1a332
......@@ -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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册