diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /taskcluster/scripts/misc/fetch-content | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/scripts/misc/fetch-content')
-rwxr-xr-x | taskcluster/scripts/misc/fetch-content | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/fetch-content b/taskcluster/scripts/misc/fetch-content index 9e6a1f4ef0..6e7b625dce 100755 --- a/taskcluster/scripts/misc/fetch-content +++ b/taskcluster/scripts/misc/fetch-content @@ -188,6 +188,25 @@ def stream_download(url, sha256=None, size=None): ) if certifi else urllib.request.urlopen(url, timeout=60) as fh: if not url.endswith(".gz") and fh.info().get("Content-Encoding") == "gzip": fh = gzip.GzipFile(fileobj=fh) + else: + # when using gzip we can't compare size or length (inflated) against content-length (compressed) + content_length = fh.getheader("content-length") + if content_length: + try: + content_length = int(content_length) + except ValueError: + raise IntegrityError( + "content-length header for %s is not an integer; got %s" + % (url, content_length) + ) + if size: + if size != content_length: + raise IntegrityError( + "size mismatch on %s: wanted %d; content-length is %d" + % (url, size, content_length) + ) + else: + size = content_length while True: chunk = fh.read(65536) |