Fix: correctly handle HTTP download sizes when stream compression is used

When HTTP stream compression was used, it would break conditional HTTP
downloading, because the streamed (so compressed) number of bytes of the
request was compared with the on-disk (so decompressed) size of the
downloaded file.

This is now fixed, and some other size-related fields have been renamed
to make it explicit that they are about the on-disk size.

Since this changes how the HTTP request metadata is stored on disk,
exising entries never match the on-disk file, and so every conditional
download will just re-download the file. This can't be helped, because
it's unknown whether the original request used stream compression or
not.

Pull Request: https://projects.blender.org/blender/blender/pulls/158334
This commit is contained in:
Sybren A. Stüvel 2026-05-08 15:34:03 +02:00
parent 7ca5713d99
commit e57b7a131f
3 changed files with 23 additions and 15 deletions

View file

@ -145,7 +145,7 @@ class MaxDownloadSizeTest(unittest.TestCase):
metadata_provider.load.return_value = None
downloader = http_dl.ConditionalDownloader(metadata_provider=metadata_provider)
downloader.max_size_bytes = 100
downloader.max_disk_size_bytes = 100
mock_response = MagicMock()
mock_response.headers = {"Content-Length": "200", "Content-Type": "text/plain"}