substitute: Honor 'Cache-Control' on 404 responses.

* guix/scripts/substitute.scm (cached-narinfo): When VALUE is #f, use
the TTL that is read instead of %NARINFO-NEGATIVE-TTL.
(cached-narinfo-expiration-time): Likewise.
This commit is contained in:
Ludovic Courtès 2017-05-11 10:24:49 +02:00
parent 24b21720f7
commit 5db5dff53d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -472,9 +472,9 @@ (define cache-file
(match (read p)
(('narinfo ('version 2)
('cache-uri cache-uri)
('date date) ('ttl _) ('value #f))
('date date) ('ttl ttl) ('value #f))
;; A cached negative lookup.
(if (obsolete? date now %narinfo-negative-ttl)
(if (obsolete? date now ttl)
(values #f #f)
(values #t #f)))
(('narinfo ('version 2)
@ -722,7 +722,7 @@ (define (cached-narinfo-expiration-time file)
(match (read port)
(('narinfo ('version 2) ('cache-uri uri)
('date date) ('ttl ttl) ('value #f))
(+ date %narinfo-negative-ttl))
(+ date ttl))
(('narinfo ('version 2) ('cache-uri uri)
('date date) ('ttl ttl) ('value value))
(+ date ttl))