commit - b829ddf046a43c54fde990d994a0106a584822d6
commit + 910e5f73b4d82fc8c000923a7d8daff9d500e1bb
blob - c59dfb159917924212025d2bf9dac6eef73c8532
blob + eec0c72d69bd3c96f2cf1392a59cf4a4deb45576
--- NEWS
+++ NEWS
0.20.43 UNRELEASED
+ * Drop caching of full HTTP response. Attempt #2.
+ (jelmer Vernooij, Antoine Lambert, #966)
+
0.20.42 2022-05-24
* Drop ``RefsContainer.watch`` that was always flaky.
blob - 33742b0dcc180037ff9545e2be5a2515192e1546
blob + 10defb0a04ced81afcdc71058669aa7331ba6488
--- dulwich/client.py
+++ dulwich/client.py
self.dumb = dumb
GitClient.__init__(self, **kwargs)
- def _http_request(self, url, headers=None, data=None, allow_compression=False):
+ def _http_request(self, url, headers=None, data=None):
"""Perform HTTP request.
Args:
url: Request URL.
headers: Optional custom headers to override defaults.
data: Request data.
- allow_compression: Allow GZipped communication.
Returns:
Tuple (`response`, `read`), where response is an `urllib3`
if self.dumb is not True:
tail += "?service=%s" % service.decode("ascii")
url = urljoin(base_url, tail)
- resp, read = self._http_request(url, headers, allow_compression=True)
+ resp, read = self._http_request(url, headers)
if resp.redirect_location:
# Something changed (redirect!), so let's update the base URL
path = path.decode("utf-8")
return urljoin(self._base_url, path).rstrip("/") + "/"
- def _http_request(self, url, headers=None, data=None, allow_compression=False):
+ def _http_request(self, url, headers=None, data=None):
req_headers = self.pool_manager.headers.copy()
if headers is not None:
req_headers.update(headers)
req_headers["Pragma"] = "no-cache"
- if allow_compression:
- req_headers["Accept-Encoding"] = "gzip"
- else:
- req_headers["Accept-Encoding"] = "identity"
if data is None:
resp = self.pool_manager.request(
resp.redirect_location = resp.get_redirect_location()
else:
resp.redirect_location = resp_url if resp_url != url else ""
- # 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
+ return resp, resp.read
HttpGitClient = Urllib3HttpGitClient