From f7e223c333c17f6e659f220f96021aad652d3486 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Wed, 24 Jun 2026 08:58:48 +0200 Subject: [PATCH] fetch-content: send Accept-Encoding header (bug 2049952) Many taskcluster artifacts are stored gzipped on GCS, requesting the compressed version means less data to transfer, and side-steps an incompatibility between GCS decompressive transcoding (which implies chunked transfer) and Fastly segmented caching. --- src/taskgraph/run-task/fetch-content | 2 +- test/test_scripts_fetch_content.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/taskgraph/run-task/fetch-content b/src/taskgraph/run-task/fetch-content index 85aaf7463..94bb2835d 100755 --- a/src/taskgraph/run-task/fetch-content +++ b/src/taskgraph/run-task/fetch-content @@ -181,7 +181,7 @@ def stream_download(url, sha256=None, size=None, headers=None): length = 0 t0 = time.time() - req_headers = {} + req_headers = {"Accept-Encoding": "gzip"} for header in headers: key, val = header.split(":") req_headers[key.strip()] = val.strip() diff --git a/test/test_scripts_fetch_content.py b/test/test_scripts_fetch_content.py index 9ebf7943d..658e0c8c2 100644 --- a/test/test_scripts_fetch_content.py +++ b/test/test_scripts_fetch_content.py @@ -65,7 +65,8 @@ def mock_urlopen(req, timeout=None, *, context=None): assert req._full_url == url assert timeout is not None if headers: - assert len(req.headers) == len(headers) + # stream_download adds accept-encoding + assert len(req.headers) == len(headers) + 1 for header in headers: k, v = header.split(":") k = k.lower().capitalize().strip()