mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
allow an empty response (#2855)
This commit is contained in:
committed by
Miek Gieben
parent
3b3fb6f583
commit
e1d0b63e3f
@@ -155,10 +155,6 @@ func templateParse(c *caddy.Controller) (handler Handler, err error) {
|
|||||||
t.regex = append(t.regex, regexp.MustCompile(".*"))
|
t.regex = append(t.regex, regexp.MustCompile(".*"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(t.answer) == 0 && len(t.authority) == 0 && t.rcode == dns.RcodeSuccess {
|
|
||||||
return handler, c.Errf("no answer section for template found: %v", handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.Templates = append(handler.Templates, t)
|
handler.Templates = append(handler.Templates, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ func TestSetupParse(t *testing.T) {
|
|||||||
{`template X`, true},
|
{`template X`, true},
|
||||||
{`template ANY`, true},
|
{`template ANY`, true},
|
||||||
{`template ANY X`, true},
|
{`template ANY X`, true},
|
||||||
{`template ANY ANY (?P<x>`, true},
|
|
||||||
{
|
|
||||||
`template ANY ANY {
|
|
||||||
|
|
||||||
}`,
|
|
||||||
true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
`template ANY ANY .* {
|
`template ANY ANY .* {
|
||||||
notavailable
|
notavailable
|
||||||
@@ -92,6 +85,13 @@ func TestSetupParse(t *testing.T) {
|
|||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
// examples
|
// examples
|
||||||
|
{`template ANY ANY (?P<x>`, false},
|
||||||
|
{
|
||||||
|
`template ANY ANY {
|
||||||
|
|
||||||
|
}`,
|
||||||
|
false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
`template ANY A example.com {
|
`template ANY A example.com {
|
||||||
match ip-(?P<a>[0-9]*)-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]com
|
match ip-(?P<a>[0-9]*)-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]com
|
||||||
|
|||||||
Reference in New Issue
Block a user