Fix cache privateness

This commit is contained in:
Star Brilliant
2018-03-21 15:08:12 +08:00
parent 2b3a261247
commit 1be3052cda
2 changed files with 4 additions and 4 deletions

View File

@@ -180,9 +180,9 @@ func (s *Server) generateResponseGoogle(w http.ResponseWriter, r *http.Request,
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
if respJSON.HaveTTL {
if req.isTailored {
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(int(respJSON.LeastTTL)))
} else {
w.Header().Set("Cache-Control", "private, max-age="+strconv.Itoa(int(respJSON.LeastTTL)))
} else {
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(int(respJSON.LeastTTL)))
}
w.Header().Set("Expires", respJSON.EarliestExpires.Format(http.TimeFormat))
}

View File

@@ -150,9 +150,9 @@ func (s *Server) generateResponseIETF(w http.ResponseWriter, r *http.Request, re
w.Header().Set("Last-Modified", now)
if respJSON.HaveTTL {
if req.isTailored {
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(int(respJSON.LeastTTL)))
} else {
w.Header().Set("Cache-Control", "private, max-age="+strconv.Itoa(int(respJSON.LeastTTL)))
} else {
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(int(respJSON.LeastTTL)))
}
w.Header().Set("Expires", respJSON.EarliestExpires.Format(http.TimeFormat))
}