Return 304 if If-Modified-Since header is present in download
This commit is contained in:
parent
bbcf77abde
commit
8f6aa65a10
|
@ -19,6 +19,15 @@ func Download(w http.ResponseWriter, r *http.Request) {
|
|||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
ifModifH := r.Header.Get("If-Modified-Since")
|
||||
if ifModifH != "" {
|
||||
// Is (probably) not modified, send back 304
|
||||
log.Printf("Download (%s): got If-Modified-Since, replying 304\n", id)
|
||||
w.WriteHeader(http.StatusNotModified)
|
||||
return
|
||||
}
|
||||
|
||||
d1 := file.Sha1Sum[0:2]
|
||||
d2 := file.Sha1Sum[2:4]
|
||||
|
||||
|
|
Loading…
Reference in New Issue