]> ruderich.org/simon Gitweb - nsscash/nsscash.git/blobdiff - file.go
nsscash: guard against unexpected 304
[nsscash/nsscash.git] / file.go
diff --git a/file.go b/file.go
index e06a9bce335ccc4e4444e5f8ea9502d27df09eba..5b8fffef41b466d0c32182fb6f71fd7c77a64978 100644 (file)
--- a/file.go
+++ b/file.go
@@ -89,12 +89,17 @@ func fetchFile(file *File, state *State) error {
                t = zero // force download
        }
 
+       oldT := t
        status, body, err := fetchIfModified(file.Url,
                file.Username, file.Password, file.CA, &t)
        if err != nil {
                return err
        }
        if status == http.StatusNotModified {
+               if oldT.IsZero() {
+                       return fmt.Errorf("status code 304 " +
+                               "but did not send If-Modified-Since")
+               }
                log.Printf("%q -> %q: not modified", file.Url, file.Path)
                return nil
        }