in internal/vfs/serving/serving.go [260:287]
func checkPreconditions(w http.ResponseWriter, r *http.Request, modtime time.Time) (done bool) {
defer slowlogs.Recorder(r.Context(), "serving.checkPreconditions")()
// This function carefully follows RFC 7232 section 6.
ch := checkIfMatch(w, r)
if ch == condNone {
ch = checkIfUnmodifiedSince(r, modtime)
}
if ch == condFalse {
w.WriteHeader(http.StatusPreconditionFailed)
return true
}
switch checkIfNoneMatch(w, r) {
case condFalse:
if r.Method == http.MethodGet || r.Method == http.MethodHead {
writeNotModified(w)
return true
}
w.WriteHeader(http.StatusPreconditionFailed)
return true
case condNone:
if checkIfModifiedSince(r, modtime) == condFalse {
writeNotModified(w)
return true
}
}
return false
}