summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2022-12-28 18:00:40 +0100
committerPeter Wu <peter@lekensteyn.nl>2022-12-28 18:00:40 +0100
commitc749e8fd12ff00800ca0ddc2b22544dbec601ab3 (patch)
treed67bbc722ed7042b8088932bbb3bd1e4d4696041
parentb703e972dc4c686a3f7780c6f6b4050f23d7417c (diff)
downloadscripts-master.tar.gz
arch-proxy.py: ignore empty files in cacheHEADmaster
-rwxr-xr-xarch-proxy.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch-proxy.py b/arch-proxy.py
index 5a7b2c2..a456c77 100755
--- a/arch-proxy.py
+++ b/arch-proxy.py
@@ -167,6 +167,9 @@ class RequestHandler(http.server.BaseHTTPRequestHandler):
try:
# Try to open cached file and yield data from it
stat_info = os.stat(path)
+ if stat_info.st_size == 0:
+ # Treat empty files as missing.
+ raise FileNotFoundError
response_headers = {'Last-Modified':
epoch_to_text(stat_info.st_mtime)}
self.send_ok(stat_info.st_size, response_headers,