1. ensure replicated file has the same timestamp

2. upload can specify modified time by &ts=...
3. correctly return code 304
This commit is contained in:
Chris Lu
2013-07-10 00:25:14 -07:00
parent 53b6831f73
commit 4c200acd7d
5 changed files with 20 additions and 9 deletions

View File

@@ -149,7 +149,7 @@ func GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool)
w.Header().Set("Last-Modified", time.Unix(int64(n.LastModified), 0).UTC().Format(http.TimeFormat))
if r.Header.Get("If-Modified-Since") != "" {
if t, parseError := time.Parse(http.TimeFormat, r.Header.Get("If-Modified-Since")); parseError == nil {
if t.Unix() <= int64(n.LastModified) {
if t.Unix() >= int64(n.LastModified) {
w.WriteHeader(http.StatusNotModified)
return
}