mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
cmd/syncthing: Correctly compare If-Modified-Since in HTTP server (#5016)
This commit is contained in:
parent
54e17c8bf4
commit
7d3f94911f
@ -131,9 +131,11 @@ func (s *staticsServer) serveAsset(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Set("Last-Modified", modified.Format(http.TimeFormat))
|
w.Header().Set("Last-Modified", modified.Format(http.TimeFormat))
|
||||||
w.Header().Set("Etag", etag)
|
w.Header().Set("Etag", etag)
|
||||||
|
|
||||||
if t, err := time.Parse(http.TimeFormat, r.Header.Get("If-Modified-Since")); err == nil && modified.Add(time.Second).After(t) {
|
if t, err := time.Parse(http.TimeFormat, r.Header.Get("If-Modified-Since")); err == nil {
|
||||||
w.WriteHeader(http.StatusNotModified)
|
if modified.Equal(t) || modified.Before(t) {
|
||||||
return
|
w.WriteHeader(http.StatusNotModified)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if match := r.Header.Get("If-None-Match"); match != "" {
|
if match := r.Header.Get("If-None-Match"); match != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user