aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/cache.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-06-27 21:12:27 +0100
committerGravatar GitHub <noreply@github.com> 2018-06-27 21:12:27 +0100
commitdae506b5638c7309399cb273d7f76bc20ee518dd (patch)
tree3fe5eb2c2e2d4b7e047fe87ebeccc0e9e7aa5ea4 /plugin/cache/cache.go
parent99287d091c2db4028e54782fd4de43f63ca4b040 (diff)
downloadcoredns-dae506b5638c7309399cb273d7f76bc20ee518dd.tar.gz
coredns-dae506b5638c7309399cb273d7f76bc20ee518dd.tar.zst
coredns-dae506b5638c7309399cb273d7f76bc20ee518dd.zip
Fix max-age in http server (#1890)
* Fix max-age in http server Move the minMsgTTL to dnsutil and rename it MinimalTTL, move some constants there as well. Use these new function in server_https to correctly set the max-age HTTP header. Fixes: #1823 * Linter
Diffstat (limited to 'plugin/cache/cache.go')
-rw-r--r--plugin/cache/cache.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugin/cache/cache.go b/plugin/cache/cache.go
index ed39fee86..c46267658 100644
--- a/plugin/cache/cache.go
+++ b/plugin/cache/cache.go
@@ -9,6 +9,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/cache"
+ "github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/response"
"github.com/coredns/coredns/request"
@@ -158,7 +159,7 @@ func (w *ResponseWriter) WriteMsg(res *dns.Msg) error {
duration = w.nttl
}
- msgTTL := minMsgTTL(res, mt)
+ msgTTL := dnsutil.MinimalTTL(res, mt)
if msgTTL < duration {
duration = msgTTL
}
@@ -226,9 +227,8 @@ func (w *ResponseWriter) Write(buf []byte) (int, error) {
}
const (
- maxTTL = 1 * time.Hour
- maxNTTL = 30 * time.Minute
- failSafeTTL = 5 * time.Second
+ maxTTL = dnsutil.MaximumDefaulTTL
+ maxNTTL = dnsutil.MaximumDefaulTTL / 2
defaultCap = 10000 // default capacity of the cache.