pkg/typify: empty messages are OtherError (#1531)
Messages with nothing in them are considered OtherError, they can not serve any purpose for normal clients (i.e. dyn update or notifies might have a use for them). Also update a test in the cache plugin, so that we explicitaly test for this case.
This commit is contained in:
parent
f10627c1d6
commit
fc1d73ffa9
4 changed files with 35 additions and 1 deletions
11
plugin/cache/cache_test.go
vendored
11
plugin/cache/cache_test.go
vendored
|
@ -22,6 +22,7 @@ type cacheTestCase struct {
|
|||
Authoritative bool
|
||||
RecursionAvailable bool
|
||||
Truncated bool
|
||||
Response bool
|
||||
shouldCache bool
|
||||
}
|
||||
|
||||
|
@ -111,6 +112,15 @@ var cacheTestCases = []cacheTestCase{
|
|||
},
|
||||
shouldCache: false,
|
||||
},
|
||||
{
|
||||
// Response with only something in the additional, this should not be cached.
|
||||
Response: true,
|
||||
in: test.Case{
|
||||
Qname: "example.org.", Qtype: dns.TypeMX,
|
||||
Extra: []dns.RR{test.MX("example.org. 1800 IN MX 1 mx.example.org.")},
|
||||
},
|
||||
shouldCache: false,
|
||||
},
|
||||
{
|
||||
RecursionAvailable: true, Authoritative: true,
|
||||
Case: test.Case{
|
||||
|
@ -140,6 +150,7 @@ func cacheMsg(m *dns.Msg, tc cacheTestCase) *dns.Msg {
|
|||
m.AuthenticatedData = tc.AuthenticatedData
|
||||
m.Authoritative = tc.Authoritative
|
||||
m.Rcode = tc.Rcode
|
||||
m.Response = tc.Response
|
||||
m.Truncated = tc.Truncated
|
||||
m.Answer = tc.in.Answer
|
||||
m.Ns = tc.in.Ns
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue