diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-01-02 14:23:25 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-01-02 14:23:25 -0800 |
| commit | 7f74577db10bcb9e06b6963272316b0f901999d6 (patch) | |
| tree | 483bb852a3fe9fb673ebf9f48bd922fb4a5f9143 | |
| parent | ceafb7d1457a5e6d042b0fd9a0e066a80100af13 (diff) | |
| download | seaweedfs-7f74577db10bcb9e06b6963272316b0f901999d6.tar.xz seaweedfs-7f74577db10bcb9e06b6963272316b0f901999d6.zip | |
add Last-Modified to HEAD requests1.19
to work better with restic
| -rw-r--r-- | weed/server/filer_server_handlers_read.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index 554ce3fd1..226de640c 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -2,17 +2,17 @@ package weed_server import ( "io" + "mime" + "mime/multipart" "net/http" "net/url" + "path" + "strconv" "strings" "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/util" - "mime" - "mime/multipart" - "path" - "strconv" ) func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) { @@ -50,6 +50,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, w.Header().Set("Accept-Ranges", "bytes") if r.Method == "HEAD" { w.Header().Set("Content-Length", strconv.FormatInt(int64(filer2.TotalSize(entry.Chunks)), 10)) + w.Header().Set("Last-Modified", entry.Attr.Mtime.Format(http.TimeFormat)) return } |
