Closed Eoic closed 6 months ago
@Eoic This is probably caused by the response header: Content-Encoding: gzip
This causes the file to be "unzipped" automatically (by requests
) before python-tuf
gets a chance to check the file hash.
The solution is to configure your server as follows:
Content-Encoding
headerContent-Type: application/gzip
Describe the bug I serve
targets
andmetadata
files with Flask, usinggunicorn
server. When I open the application, it tries to download and apply the update, but fails withDownloadLengthMismatchError
. Correct file from the server is requested and size of the requested file intargets.json
is correct. Anyway, when I serve files withhttp.server
, it works as expected.Here is a relevant section from
targets.json
:Here is a stack trace of the exception when trying to download an update:
To Reproduce Steps to reproduce the behavior:
metadata
andtargets
files usingFlask
:gunicorn
server:gunicorn -w 4 -k gevent --timeout 1800 --bind 0.0.0.0:8000 src.server:app
.tufup.client.Client
instance.check_for_updates()
, and thendownload_and_apply_update()
.Expected behavior
targets.json
metadata file.Screenshots -
System info (please complete the following information):
Additional context Here are response headers when fetching target file with
curl
. Response size seems to be correct: