Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/fs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func directory(fi os.FileInfo, js string, w http.ResponseWriter, request *http.R
w.Header().Set("Content-Length", strconv.FormatInt(size, 10))
w.Header().Set("Last-Modified", fi.ModTime().UTC().Format(http.TimeFormat))
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Cache-Control", "max-age=0, private, must-revalidate")
w.WriteHeader(http.StatusOK)
w.Write(json)
status = 200
Expand Down Expand Up @@ -266,6 +267,7 @@ func (service *MercuryFsService) serve_file(writer http.ResponseWriter, request
} else {
writer.Header().Set("Last-Modified", mtime)
writer.Header().Set("ETag", etag)
writer.Header().Set("Cache-Control", "max-age=0, private, must-revalidate")
debug(4, "Etag sent: %s", etag)
http.ServeContent(writer, request, full_path, fi.ModTime(), osFile)
log("\"GET %s\" %d %d \"%s\"", query, 200, fi.Size(), ua)
Expand Down Expand Up @@ -293,6 +295,7 @@ func (service *MercuryFsService) serve_shares(writer http.ResponseWriter, reques
writer.Header().Set("Last-Modified", service.Shares.LastChecked.Format(http.TimeFormat))
writer.Header().Set("ETag", etag)
writer.Header().Set("Content-Type", "application/json")
writer.Header().Set("Cache-Control", "max-age=0, private, must-revalidate")
writer.WriteHeader(http.StatusOK)
writer.Write([]byte(json))
service.debug_info.requestServed(size)
Expand Down Expand Up @@ -407,6 +410,7 @@ func (service *MercuryFsService) apps_list(writer http.ResponseWriter, request *
writer.Header().Set("Content-Length", strconv.FormatInt(size, 10))
writer.Header().Set("ETag", etag)
writer.Header().Set("Content-Type", "application/json")
writer.Header().Set("Cache-Control", "max-age=0, private, must-revalidate")
writer.WriteHeader(http.StatusOK)
writer.Write([]byte(json))
service.debug_info.requestServed(size)
Expand Down Expand Up @@ -451,6 +455,7 @@ func (service *MercuryFsService) get_metadata(writer http.ResponseWriter, reques
writer.Header().Set("Content-Length", strconv.FormatInt(size, 10))
writer.Header().Set("ETag", etag)
writer.Header().Set("Content-Type", "application/json")
writer.Header().Set("Cache-Control", "max-age=0, private, must-revalidate")
writer.WriteHeader(http.StatusOK)
writer.Write([]byte(json))
service.debug_info.requestServed(size)
Expand Down