]> ruderich.org/simon Gitweb - nsscash/nsscash.git/commitdiff
nsscash: force UTC timezone for If-Modified-Since header
authorSimon Ruderich <simon@ruderich.org>
Fri, 2 Aug 2019 19:04:25 +0000 (21:04 +0200)
committerSimon Ruderich <simon@ruderich.org>
Fri, 2 Aug 2019 19:04:25 +0000 (21:04 +0200)
This is not strictly required as lastModified is already stored in UTC
(servers use UTC for the Last-Modified header). However, it's good
practice and prevents copy & past errors in the future. See d71bfc6
("nsscash: main_test: fix Last-Modified/If-Modified-Since headers",
2019-08-02) for the details.

fetch.go

index ba1bbc8f4bde2019503102a1100ea1cf01bcc0a0..491720a88786d0c363bc612048a6ce0e1f6b98b5 100644 (file)
--- a/fetch.go
+++ b/fetch.go
@@ -43,7 +43,7 @@ func fetchIfModified(url, ca string, lastModified *time.Time) (int, []byte, erro
        }
        if !lastModified.IsZero() {
                req.Header.Add("If-Modified-Since",
-                       lastModified.Format(http.TimeFormat))
+                       lastModified.UTC().Format(http.TimeFormat))
        }
 
        client, ok := clients[ca]