diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-11-16 19:28:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-16 19:28:52 -0500 |
commit | 0135904f7d3e1c0e763adaefe267c736616e3d26 (patch) | |
tree | c27be7588f98eaea62e0bd0c0087f2b348da9738 /vendor/github.com/gorilla/handlers/proxy_headers_test.go | |
parent | 0b296dd8c2aefefe89787be5cc627d44cf431150 (diff) | |
download | chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.gz chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.bz2 chat-0135904f7d3e1c0e763adaefe267c736616e3d26.zip |
Upgrading server dependancies (#4566)
Diffstat (limited to 'vendor/github.com/gorilla/handlers/proxy_headers_test.go')
-rw-r--r-- | vendor/github.com/gorilla/handlers/proxy_headers_test.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/vendor/github.com/gorilla/handlers/proxy_headers_test.go b/vendor/github.com/gorilla/handlers/proxy_headers_test.go index 85282ef7d..1bd78052d 100644 --- a/vendor/github.com/gorilla/handlers/proxy_headers_test.go +++ b/vendor/github.com/gorilla/handlers/proxy_headers_test.go @@ -47,6 +47,9 @@ func TestGetScheme(t *testing.T) { {xForwardedProto, "https", "https"}, {xForwardedProto, "http", "http"}, {xForwardedProto, "HTTP", "http"}, + {xForwardedScheme, "https", "https"}, + {xForwardedScheme, "http", "http"}, + {xForwardedScheme, "HTTP", "http"}, {forwarded, `For="[2001:db8:cafe::17]:4711`, ""}, // No proto {forwarded, `for=192.0.2.43, for=198.51.100.17;proto=https`, "https"}, // Multiple params before proto {forwarded, `for=172.32.10.15; proto=https;by=127.0.0.1`, "https"}, // Space before proto @@ -74,13 +77,17 @@ func TestProxyHeaders(t *testing.T) { r.Header.Set(xForwardedFor, "8.8.8.8") r.Header.Set(xForwardedProto, "https") - - var addr string - var proto string + r.Header.Set(xForwardedHost, "google.com") + var ( + addr string + proto string + host string + ) ProxyHeaders(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { addr = r.RemoteAddr proto = r.URL.Scheme + host = r.Host })).ServeHTTP(rr, r) if rr.Code != http.StatusOK { @@ -96,5 +103,9 @@ func TestProxyHeaders(t *testing.T) { t.Fatalf("wrong address: got %s want %s", proto, r.Header.Get(xForwardedProto)) } + if host != r.Header.Get(xForwardedHost) { + t.Fatalf("wrong address: got %s want %s", host, + r.Header.Get(xForwardedHost)) + } } |