Commit graph

11 commits

Author SHA1 Message Date
Laurence Withers
eb7059a302 cmd/packserver: add --immutable flag 2026-08-28 12:08:03 +01:00
Laurence Withers
8dd8ebacc1 cmd/packserver: better default behaviour for --expiry404
Now inherits from --expiry, but with a maximum of 60s. Intended to allow for
short negative caching, without causing issues with newly-created assets.
2026-08-28 11:16:15 +01:00
Laurence Withers
7d96b5bdcb cmd/packserver: update libs, add expiry404 option
The default Cache-Control header now becomes "no-cache". When the
--expiry option is used, it only applies to HTTP 200 responses. There is
a new --expiry404 option dessigned to allow for a short caching period
of invalid paths, but allowing regular re-checking in case the asset
becomes avaoilable in the future.
2026-08-28 10:56:48 +01:00
Laurence Withers
2b280de481 Correct handling of multiple packfiles
During the 1.3.1 update, a change was made to stop using http.Handle (and ServeMux
underneath), in order to have manual control over the http.Server object.

Unfortunately, it was overlooked that nothing was doing routing / multiplexing, so
when using multiple packfiles only one handler (picked arbitrarily due to map)
would actually be active on any given invocation.

Correct this by adding an explicit handler. We don't use ServeMux so as to avoid
bringing in any of its more complex behaviours like path cleaning etc.
2022-12-12 10:26:55 +00:00
Laurence Withers
5398dddb02 Add --graceful-shutdown-delay
This option allows a configurable delay after receiving SIGTERM (or
SIGINT) but before the HTTP server stops accepting new connections. It
is quite useful for distributed systems where callers are only notified
asynchronously (e.g. via service discovery) that a service is being shut
down; it prevents the shut down from occurring prior to callers
processing the notification.

This required some minor refactoring to allow the Shutdown() method on
http.Server to be accessed.
2022-11-26 10:43:18 +00:00
Laurence Withers
565a269cef cmd/packserver: add --frames option
Allows override of the X-Frame-Options header on the handler.
2022-07-06 10:33:54 +01:00
Laurence Withers
f70914aa38 cmd/packserver: add --fallback-404 arg for Angular-style SPA support 2020-02-15 12:35:05 +00:00
Laurence Withers
984639d475 Finish porting child modules to src.lwithers.me.uk 2020-01-15 18:36:05 +00:00
Laurence Withers
21a18eced6 cmd/packserver: use Cache-Control: no-cache
Rather than setting "Cache-Control: no-store", use "no-cache". The
difference is that "no-store" tells the browser that it must always
completely re-fetch the resource; whereas "no-cache" means that the
browser can write the resource to disk but must re-validate it (e.g.
using Etags) before re-using it.
2019-04-25 14:47:13 +01:00
Laurence Withers
246aefbec4 cmd/packserver: add --index-file argument 2019-04-25 14:45:18 +01:00
Laurence Withers
527b361b51 Finish up the initial packserver implementation 2019-04-15 14:10:26 +01:00