Browse Source

Revert removal of caching full HTTP response. See #966 for details.

Jelmer Vernooij 2 years ago
parent
commit
877095b47a
2 changed files with 7 additions and 1 deletions
  1. 4 0
      NEWS
  2. 3 1
      dulwich/client.py

+ 4 - 0
NEWS

@@ -8,6 +8,10 @@
  * Increase tolerance when comparing time stamps; fixes some
    spurious test failures on slow CI systems. (Jelmer Vernooij)
 
+ * Revert removal of caching of full HTTP response. This breaks
+   access to some HTTP servers.
+   (Jelmer Vernooij)
+
 0.20.37	2022-05-16
 
  * Avoid making an extra copy when fetching pack files.

+ 3 - 1
dulwich/client.py

@@ -2232,7 +2232,9 @@ class Urllib3HttpGitClient(AbstractHttpGitClient):
             resp.redirect_location = resp.get_redirect_location()
         else:
             resp.redirect_location = resp_url if resp_url != url else ""
-        return resp, resp.read
+        # TODO(jelmer): Remove BytesIO() call that caches entire response in
+        # memory. See https://github.com/jelmer/dulwich/issues/966
+        return resp, BytesIO(resp.data).read
 
 
 HttpGitClient = Urllib3HttpGitClient