middleware/caching: don't set TTL on OPT
When setting the TTL on all RR in the message we would also do this for the OPT RR. This is wrong as the OPT RR does *not* have a TTL.
This commit is contained in:
parent
069b61ff15
commit
d35394a8df
2 changed files with 8 additions and 1 deletions
6
middleware/cache/cache.go
vendored
6
middleware/cache/cache.go
vendored
|
@ -74,7 +74,7 @@ func (c *CachingResponseWriter) WriteMsg(res *dns.Msg) error {
|
|||
|
||||
func (c *CachingResponseWriter) set(m *dns.Msg, key string, mt middleware.MsgType) {
|
||||
if key == "" {
|
||||
// logger the log? TODO(miek)
|
||||
log.Printf("[ERROR] Caching called with empty cache key")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -94,6 +94,10 @@ func (c *CachingResponseWriter) set(m *dns.Msg, key string, mt middleware.MsgTyp
|
|||
i := newItem(m, duration)
|
||||
|
||||
c.cache.Set(key, i, duration)
|
||||
case middleware.OtherError:
|
||||
// don't cache these
|
||||
default:
|
||||
log.Printf("[WARNING] Caching called with unknown middleware MsgType: %d", mt)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue