Konstantin Lebedev
11 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
1 deletions
-
weed/server/filer_server_handlers_read.go
|
|
@ -67,12 +67,14 @@ func checkPreconditions(w http.ResponseWriter, r *http.Request, entry *filer.Ent |
|
|
|
ifModifiedSinceHeader := r.Header.Get("If-Modified-Since") |
|
|
|
if ifNoneMatchETagHeader != "" { |
|
|
|
if util.CanonicalizeETag(etag) == util.CanonicalizeETag(ifNoneMatchETagHeader) { |
|
|
|
setEtag(w, etag) |
|
|
|
w.WriteHeader(http.StatusNotModified) |
|
|
|
return true |
|
|
|
} |
|
|
|
} else if ifModifiedSinceHeader != "" { |
|
|
|
if t, parseError := time.Parse(http.TimeFormat, ifModifiedSinceHeader); parseError == nil { |
|
|
|
if !t.Before(entry.Attr.Mtime) { |
|
|
|
setEtag(w, etag) |
|
|
|
w.WriteHeader(http.StatusNotModified) |
|
|
|
return true |
|
|
|
} |
|
|
@ -147,11 +149,11 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
etag := filer.ETagEntry(entry) |
|
|
|
if checkPreconditions(w, r, entry) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
etag := filer.ETagEntry(entry) |
|
|
|
w.Header().Set("Accept-Ranges", "bytes") |
|
|
|
|
|
|
|
// mime type
|
|
|
|