summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/matchers_test.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-12-17 10:14:04 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-12-17 10:14:04 -0700
commitdae4913fe35ff3f8a97383061ea8d44c1e98279e (patch)
tree5d6cd9453b225fbdb3fc86d815d4d7560bca6ea5 /modules/caddyhttp/matchers_test.go
parent6455efa5d327377b41e708a063d1b7a71a131165 (diff)
http: Patch path matcher to ignore dots and spaces (#2917)
(Try saying "patch path match" ten times fast)
Diffstat (limited to 'modules/caddyhttp/matchers_test.go')
-rw-r--r--modules/caddyhttp/matchers_test.go12
1 files changed, 12 insertions, 0 deletions
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