This commit is contained in:
mark committed 2026-09-04 11:52:10 -04:00
1 parent 6925c46568
commit 7127e3ff9d
27 files changed
+721 -676

No files matched your search

+10 -3
View File
@@ -220,12 +220,19 @@ class Handler(SimpleHTTPRequestHandler):
path = self.path.split("?", 1)[0]
name = posixpath.basename(path)
ext = posixpath.splitext(name)[1].lower()
if name in NO_CACHE_NAMES or ext in NO_CACHE_EXTS or path.endswith("/"):
# A dot in the last segment means a file; anything else is a page. The
# same test the worker's isFile() makes, and it has to stay the same
# one. Matching on the extension alone was right while pages were
# /GEN.html; the moment the URL space went extensionless it silently
# handed every book a week of browser caching that no rebuild could
# get past -- the worker's own fetch reads the browser cache too, so
# even a fresh library cache was being filled from a stale one.
if name in NO_CACHE_NAMES or ext in NO_CACHE_EXTS or "." not in name:
self.send_header("Cache-Control", "no-cache")
else:
self.send_header("Cache-Control", "public, max-age=604800")
# One URL, two bodies: a navigation to /GEN.html gets the boot page and
# a fetch of it gets the fragment. Without this the browser cache keeps
# One URL, two bodies: a navigation to /GEN gets the boot page and a
# fetch of it gets the fragment. Without this the browser cache keeps
# one entry for both, and boot.html asking for its own fragment is
# handed back a copy of itself -- a document nested inside a document.
self.send_header("Vary", "Sec-Fetch-Mode")