소스 검색

Don't double-decompress gzipped HTTP responses

When using urllib3.response.HTTPResponse's data attribute, decompression of the
response contents is transparent.

Reference: https://forge.softwareheritage.org/T1195
Test-Repository: https://forge.softwareheritage.org/source/helloworld.git
Nicolas Dandrimont 6 년 전
부모
커밋
29d52070a1
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 4
      dulwich/client.py

+ 1 - 4
dulwich/client.py

@@ -1435,10 +1435,7 @@ class HttpGitClient(GitClient):
         # `BytesIO`, if we can guarantee that the entire response is consumed
         # before issuing the next to still allow for connection reuse from the
         # pool.
-        if resp.getheader("Content-Encoding") == "gzip":
-            read = gzip.GzipFile(fileobj=BytesIO(resp.data)).read
-        else:
-            read = BytesIO(resp.data).read
+        read = BytesIO(resp.data).read
 
         resp.content_type = resp.getheader("Content-Type")
         resp.redirect_location = resp.get_redirect_location()