mirror of
https://github.com/coredns/coredns.git
synced 2025-11-23 20:24:02 -05:00
plugin/rewrite: pre-compile CNMAE rewrite regexp (#7697)
This commit changes the CNAME rewrite rule to use a pre-compiled regexp when the match type is RegexMatch instead of compiling it on-the-fly for each request. This will also allow for invalid regexp patterns to be identified during setup instead of causing a panic when the rule is first invoked. Signed-off-by: Charlie Vieth <charlie.vieth@gmail.com>
This commit is contained in:
@@ -33,6 +33,7 @@ func TestParse(t *testing.T) {
|
||||
}`, true, "must begin with a name rule"},
|
||||
{`rewrite stop`, true, ""},
|
||||
{`rewrite continue`, true, ""},
|
||||
{`rewrite stop name regex [bad[ bar answer name bar foo`, true, ""},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user