[elbe-devel] [PATCH 5/5] elbepack: repo: set Content-Length header
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Jul 15 12:04:32 CEST 2024
Newer versions of apt require the header Content-Length to be set,
or GPG validation will fail.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/daemons/repo.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/elbepack/daemons/repo.py b/elbepack/daemons/repo.py
index 488dd9f2b98a..8c6baec739f2 100644
--- a/elbepack/daemons/repo.py
+++ b/elbepack/daemons/repo.py
@@ -21,7 +21,10 @@ def _app(environ, respond):
# Return 200 OK if file exists, otherwise 404 Not Found
logger.warn('Serving as %s: "%s"', mime_type, fn)
if os.path.exists(fn):
- respond('200 OK', [('Content-Type', mime_type)])
+ respond('200 OK', [
+ ('Content-Type', mime_type),
+ ('Content-Length', str(os.stat(fn).st_size)),
+ ])
return wsgiref.util.FileWrapper(open(fn, 'rb'))
else:
respond('404 Not Found', [('Content-Type', 'text/plain')])
--
2.45.2
More information about the elbe-devel
mailing list