caching_proxy.py: only take .deb and by-hash artifacts from the old path
This commit is contained in:
parent
db2be70f88
commit
1ffa32f590
1 changed files with 6 additions and 1 deletions
|
@ -46,7 +46,12 @@ class ProxyRequestHandler(http.server.BaseHTTPRequestHandler):
|
||||||
newpath = pathlib.Path("/dev/null")
|
newpath = pathlib.Path("/dev/null")
|
||||||
|
|
||||||
# copy from oldpath to newpath and send back to client
|
# copy from oldpath to newpath and send back to client
|
||||||
if oldpath.exists():
|
# Only take files from the old cache if they are .deb files or Packages
|
||||||
|
# files in the by-hash directory as only those are unique by their path
|
||||||
|
# name. Other files like InRelease files have to be downloaded afresh.
|
||||||
|
if oldpath.exists() and (
|
||||||
|
oldpath.suffix == ".deb" or "by-hash" in oldpath.parts
|
||||||
|
):
|
||||||
print(f"proxy cached: {self.path}", file=sys.stderr)
|
print(f"proxy cached: {self.path}", file=sys.stderr)
|
||||||
self.wfile.write(b"HTTP/1.1 200 OK\r\n")
|
self.wfile.write(b"HTTP/1.1 200 OK\r\n")
|
||||||
self.send_header("Content-Length", oldpath.stat().st_size)
|
self.send_header("Content-Length", oldpath.stat().st_size)
|
||||||
|
|
Loading…
Reference in a new issue