summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/fileserver/matcher.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-12-29 13:12:52 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-12-29 13:12:52 -0700
commit95d944613bffce1cee3783568ae229e116168ba4 (patch)
tree8ccfe59b7852fbc1e937d62898cec52f92ee2c44 /modules/caddyhttp/fileserver/matcher.go
parent2b33d9a5e5d1bd12d27bea2cfe8341fd1e5703b2 (diff)
Export Replacer and use concrete type instead of interface
The interface was only making things difficult; a concrete pointer is probably best.
Diffstat (limited to 'modules/caddyhttp/fileserver/matcher.go')
-rw-r--r--modules/caddyhttp/fileserver/matcher.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go
index 5ca97f2..6c1e880 100644
--- a/modules/caddyhttp/fileserver/matcher.go
+++ b/modules/caddyhttp/fileserver/matcher.go
@@ -126,7 +126,7 @@ func (m MatchFile) Validate() error {
// - http.matchers.file.relative
// - http.matchers.file.absolute
func (m MatchFile) Match(r *http.Request) bool {
- repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer)
+ repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
rel, abs, matched := m.selectFile(r)
if matched {
repl.Set("http.matchers.file.relative", rel)
@@ -140,7 +140,7 @@ func (m MatchFile) Match(r *http.Request) bool {
// It returns the root-relative path to the matched file, the full
// or absolute path, and whether a match was made.
func (m MatchFile) selectFile(r *http.Request) (rel, abs string, matched bool) {
- repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer)
+ repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
root := repl.ReplaceAll(m.Root, ".")