From 909ce9386da39317e8e24b76f345df3b58a9043f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 24 Oct 2024 21:20:19 +0200 Subject: [PATCH] core: set cache-control max-age as integer, not float (#6764) As specified in rfc2616, the max-age is an integer. Setting a float might make the header get ignored in some cases. --- core/dnsserver/server_https.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/dnsserver/server_https.go b/core/dnsserver/server_https.go index cddf59890..09c7d6200 100644 --- a/core/dnsserver/server_https.go +++ b/core/dnsserver/server_https.go @@ -188,7 +188,7 @@ func (s *ServerHTTPS) ServeHTTP(w http.ResponseWriter, r *http.Request) { age := dnsutil.MinimalTTL(dw.Msg, mt) w.Header().Set("Content-Type", doh.MimeType) - w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%f", age.Seconds())) + w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%d", uint32(age.Seconds()))) w.Header().Set("Content-Length", strconv.Itoa(len(buf))) w.WriteHeader(http.StatusOK) s.countResponse(http.StatusOK)