mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-05 03:34:41 +08:00
caddyhttp: Convert IDNs to ASCII when provisioning Host matcher
This commit is contained in:
@ -78,6 +78,11 @@ func TestHostMatcher(t *testing.T) {
|
||||
input: "bar.example.com",
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
match: MatchHost{"éxàmplê.com"},
|
||||
input: "xn--xmpl-0na6cm.com",
|
||||
expect: true,
|
||||
},
|
||||
{
|
||||
match: MatchHost{"*.example.com"},
|
||||
input: "example.com",
|
||||
@ -149,6 +154,10 @@ func TestHostMatcher(t *testing.T) {
|
||||
ctx := context.WithValue(req.Context(), caddy.ReplacerCtxKey, repl)
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
if err := tc.match.Provision(caddy.Context{}); err != nil {
|
||||
t.Errorf("Test %d %v: provisioning failed: %v", i, tc.match, err)
|
||||
}
|
||||
|
||||
actual := tc.match.Match(req)
|
||||
if actual != tc.expect {
|
||||
t.Errorf("Test %d %v: Expected %t, got %t for '%s'", i, tc.match, tc.expect, actual, tc.input)
|
||||
|
Reference in New Issue
Block a user