summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy
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/reverseproxy
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/reverseproxy')
-rw-r--r--modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go2
-rw-r--r--modules/caddyhttp/reverseproxy/hosts.go2
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go4
3 files changed, 4 insertions, 4 deletions
diff --git a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
index c0dda29..9a424b0 100644
--- a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
+++ b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
@@ -148,7 +148,7 @@ func (t Transport) RoundTrip(r *http.Request) (*http.Response, error) {
// buildEnv returns a set of CGI environment variables for the request.
func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
- repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer)
+ repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
var env map[string]string
diff --git a/modules/caddyhttp/reverseproxy/hosts.go b/modules/caddyhttp/reverseproxy/hosts.go
index e7c61fb..6e25c66 100644
--- a/modules/caddyhttp/reverseproxy/hosts.go
+++ b/modules/caddyhttp/reverseproxy/hosts.go
@@ -204,7 +204,7 @@ func (di DialInfo) String() string {
// fillDialInfo returns a filled DialInfo for the given upstream, using
// the given Replacer. Note that the returned value is not a pointer.
-func fillDialInfo(upstream *Upstream, repl caddy.Replacer) (DialInfo, error) {
+func fillDialInfo(upstream *Upstream, repl *caddy.Replacer) (DialInfo, error) {
dial := repl.ReplaceAll(upstream.Dial, "")
addr, err := caddy.ParseNetworkAddress(dial)
if err != nil {
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 24389b2..238e86f 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -263,7 +263,7 @@ func (h *Handler) Cleanup() 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 enabled, buffer client request;
// this should only be enabled if the
@@ -507,7 +507,7 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, di Dia
if h.Headers != nil && h.Headers.Response != nil {
if h.Headers.Response.Require == nil ||
h.Headers.Response.Require.Match(res.StatusCode, rw.Header()) {
- repl := req.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer)
+ repl := req.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
h.Headers.Response.ApplyTo(rw.Header(), repl)
}
}