From b78d207121f3f55da2c3486718752532a405baf8 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 19 Sep 2021 00:36:48 +0200 Subject: [PATCH] encourage statics caching --- copyparty/httpcli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 764cf65a..c21930d9 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1405,10 +1405,12 @@ class HttpCli(object): # # send reply - if not is_compressed and "cache" not in self.uparam: - self.out_headers.update(NO_CACHE) + if is_compressed: + self.out_headers["Cache-Control"] = "max-age=573" + elif "cache" in self.uparam: + self.out_headers["Cache-Control"] = "max-age=69" else: - self.out_headers.pop("Cache-Control") + self.out_headers.update(NO_CACHE) self.out_headers["Accept-Ranges"] = "bytes" self.send_headers( @@ -2154,7 +2156,7 @@ class HttpCli(object): for d in dirs: d["name"] += "/" - dirs.sort(key=itemgetter('name')) + dirs.sort(key=itemgetter("name")) j2a["files"] = dirs + files j2a["logues"] = logues