diff options
author | Matthew Holt <[email protected]> | 2019-12-29 13:12:52 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-12-29 13:12:52 -0700 |
commit | 95d944613bffce1cee3783568ae229e116168ba4 (patch) | |
tree | 8ccfe59b7852fbc1e937d62898cec52f92ee2c44 /modules/caddyhttp/headers | |
parent | 2b33d9a5e5d1bd12d27bea2cfe8341fd1e5703b2 (diff) | |
download | caddy-95d944613bffce1cee3783568ae229e116168ba4.tar.gz caddy-95d944613bffce1cee3783568ae229e116168ba4.zip |
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/headers')
-rw-r--r-- | modules/caddyhttp/headers/headers.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/caddyhttp/headers/headers.go b/modules/caddyhttp/headers/headers.go index ad6c08b18..8dec42cbc 100644 --- a/modules/caddyhttp/headers/headers.go +++ b/modules/caddyhttp/headers/headers.go @@ -88,7 +88,7 @@ func (h Handler) Validate() error { } func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error { - repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer) + repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) if h.Request != nil { h.Request.ApplyToRequest(r) @@ -182,7 +182,7 @@ type RespHeaderOps struct { } // ApplyTo applies ops to hdr using repl. -func (ops HeaderOps) ApplyTo(hdr http.Header, repl caddy.Replacer) { +func (ops HeaderOps) ApplyTo(hdr http.Header, repl *caddy.Replacer) { // add for fieldName, vals := range ops.Add { fieldName = repl.ReplaceAll(fieldName, "") @@ -249,7 +249,7 @@ func (ops HeaderOps) ApplyTo(hdr http.Header, repl caddy.Replacer) { // header which the standard library does not include with the // header map with all the others. This method mutates r.Host. func (ops HeaderOps) ApplyToRequest(r *http.Request) { - repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer) + repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) // capture the current Host header so we can // reset to it when we're done @@ -285,7 +285,7 @@ func (ops HeaderOps) ApplyToRequest(r *http.Request) { // operations until WriteHeader is called. type responseWriterWrapper struct { *caddyhttp.ResponseWriterWrapper - replacer caddy.Replacer + replacer *caddy.Replacer require *caddyhttp.ResponseMatcher headerOps *HeaderOps wroteHeader bool |