diff options
Diffstat (limited to 'nvdmirror/util.go')
-rw-r--r-- | nvdmirror/util.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nvdmirror/util.go b/nvdmirror/util.go index 9cf7d3a..d54e41b 100644 --- a/nvdmirror/util.go +++ b/nvdmirror/util.go @@ -16,7 +16,7 @@ func getFileSize(path string) (uint64, error) { } } -// log array of strings +// Log array of strings. func logArray(key string, strs []string) { // populate array a := zerolog.Arr() @@ -27,3 +27,12 @@ func logArray(key string, strs []string) { // log array log.Info().Array(key, a).Send() } + +// Get source URL, etag response header, and last-modified response +// header from fetchResult and save them in the given cache. +func saveHeaders(cache Cache, fr fetchResult) error { + return cache.Set(fr.src, map[string]string { + "if-none-match": fr.headers.Get("etag"), + "if-modified-since": fr.headers.Get("last-modified"), + }) +} |