Merge branch v2.11 into v3.3

This commit is contained in:
romain 2025-03-31 10:03:17 +02:00
commit e817d822d7
6 changed files with 39 additions and 7 deletions

View file

@ -67,7 +67,7 @@ func clientIP(tree *matchersTree, clientIP ...string) error {
return nil
}
var hostOrIP = regexp.MustCompile(`^[[:alnum:]\.\-\:]+$`)
var hostOrIP = regexp.MustCompile(`^[[:word:]\.\-\:]+$`)
// hostSNI checks if the SNI Host of the connection match the matcher host.
func hostSNI(tree *matchersTree, hosts ...string) error {

View file

@ -133,6 +133,12 @@ func Test_HostSNI(t *testing.T) {
serverName: "foo.example.com",
match: true,
},
{
desc: "Matching hosts with subdomains with _",
rule: "HostSNI(`foo_bar.example.com`)",
serverName: "foo_bar.example.com",
match: true,
},
}
for _, test := range testCases {

View file

@ -690,6 +690,11 @@ func Test_HostSNIV2(t *testing.T) {
ruleHosts: []string{"foo.bar"},
serverName: "foo.bar",
},
{
desc: "Matching hosts with subdomains with _",
ruleHosts: []string{"foo_bar.example.com"},
serverName: "foo_bar.example.com",
},
{
desc: "Matching IPv4",
ruleHosts: []string{"127.0.0.1"},