publish: Add a 'Cache-Control' header on /nar responses.
authorLudovic Courtès <ludo@gnu.org>
Mon, 17 Dec 2018 22:01:51 +0000 (23:01 +0100)
committerLudovic Courtès <ludo@gnu.org>
Mon, 17 Dec 2018 22:33:42 +0000 (23:33 +0100)
commit9b9de08477afe0ea519f916ad3d33c9720c3278d
tree49cee656bcf353482b0fb918497d316b787580ce
parenta93c1606312e41ffe509977502ce6055f40bc629
publish: Add a 'Cache-Control' header on /nar responses.

Fixes <https://bugs.gnu.org/33721>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/publish.scm (render-nar/cached): Add #:ttl and honor it.
(make-request-handler): Pass #:ttl to 'render-nar/cached'.
* tests/publish.scm ("with cache, uncompressed"): Pass "--ttl=42h" to
'guix publish'.  Check 'Cache-Control' on narinfo response and on nar
response.
guix/scripts/publish.scm
tests/publish.scm