From dae4913fe35ff3f8a97383061ea8d44c1e98279e Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 17 Dec 2019 10:14:04 -0700 Subject: http: Patch path matcher to ignore dots and spaces (#2917) (Try saying "patch path match" ten times fast) --- modules/caddyhttp/matchers_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/caddyhttp/matchers_test.go') diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go index f5ec034..34a1647 100644 --- a/modules/caddyhttp/matchers_test.go +++ b/modules/caddyhttp/matchers_test.go @@ -247,6 +247,18 @@ func TestPathMatcher(t *testing.T) { } } +func TestPathMatcherWindows(t *testing.T) { + // only Windows has this bug where it will ignore + // trailing dots and spaces in a filename, but we + // test for it on all platforms to be more consistent + match := MatchPath{"*.php"} + req := &http.Request{URL: &url.URL{Path: "/index.php . . .."}} + matched := match.Match(req) + if !matched { + t.Errorf("Expected to match; should ignore trailing dots and spaces") + } +} + func TestPathREMatcher(t *testing.T) { for i, tc := range []struct { match MatchPathRE -- cgit v1.2.3