plugin/header: Remove deprecated syntax (#7436)

Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
This commit is contained in:
Qasim Sarfraz
2025-08-09 00:38:41 +02:00
committed by GitHub
parent 52639bc66c
commit 712a5050bd
3 changed files with 8 additions and 22 deletions

View File

@@ -13,12 +13,12 @@ The modifications are made transparently for the client and subsequent plugins.
~~~
header {
[SELECTOR] ACTION FLAGS...
[SELECTOR] ACTION FLAGS...
SELECTOR ACTION FLAGS...
SELECTOR ACTION FLAGS...
}
~~~
* **SELECTOR** defines if the action should be applied on `query` or `response`. In future CoreDNS version the selector will be mandatory. For backwards compatibility the action will be applied on `response` if the selector is undefined.
* **SELECTOR** defines if the action should be applied on `query` or `response`.
* **ACTION** defines the state for DNS message header flags. Actions are evaluated in the order they are defined so last one has the
most precedence. Allowed values are:

View File

@@ -38,14 +38,6 @@ func parse(c *caddy.Controller) ([]Rule, []Rule, error) {
var action string
switch selector {
case "set", "clear":
log.Warningf("The selector for header rule in line %d isn't explicit defined. "+
"Assume rule applies for selector 'response'. This syntax is deprecated. "+
"In future versions of CoreDNS the selector must be explicit defined.",
c.Line())
action = selector
selector = "response"
case "query", "response":
if c.NextArg() {
action = c.Val()

View File

@@ -14,24 +14,18 @@ func TestSetupHeader(t *testing.T) {
expectedErrContent string
}{
{`header {}`, true, "Wrong argument count or unexpected line ending after"},
{`header {
set
}`, true, "invalid length for flags, at least one should be provided"},
{`header {
foo
}`, true, "invalid selector=foo should be query or response"},
{`header {
response set
}`, true, "invalid length for flags, at least one should be provided"},
{`header {
query foo
}`, true, "invalid length for flags, at least one should be provided"},
{`header {
query foo rd
}`, true, "unknown flag action=foo, should be set or clear"},
{`header {
set ra
}`, false, ""},
{`header {
clear ra
}`, false, ""},
{`header {
query set rd
}`, false, ""},
@@ -39,8 +33,8 @@ func TestSetupHeader(t *testing.T) {
response set aa
}`, false, ""},
{`header {
set ra aa
clear rd
response set ra aa
query clear rd
}`, false, ""},
}