diff options
author | Jamie Woods <jamie.woods@bbc.co.uk> | 2018-04-11 12:15:18 +0100 |
---|---|---|
committer | Jamie Woods <jamie.woods@bbc.co.uk> | 2018-04-11 12:15:18 +0100 |
commit | 13dce5667f4009c9b600270ab7eb55cd8dc22495 (patch) | |
tree | 0bd87181778d35a201b71f02f2627349884050c5 /test/spec_urlmap.rb | |
parent | c15733d76851651600f5ded5f03bfd7a40544af3 (diff) | |
download | rack-13dce5667f4009c9b600270ab7eb55cd8dc22495.tar.gz |
Update URLMap to default to empty host, if HTTP_HOST (and hence HTTP_X_FORWARED_HOST) is defined, fixing 990
Diffstat (limited to 'test/spec_urlmap.rb')
-rw-r--r-- | test/spec_urlmap.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/spec_urlmap.rb b/test/spec_urlmap.rb index 9d655c22..f88ee606 100644 --- a/test/spec_urlmap.rb +++ b/test/spec_urlmap.rb @@ -117,6 +117,14 @@ describe Rack::URLMap do res.must_be :ok? res["X-Position"].must_equal "default.org" + res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "any-host.org") + res.must_be :ok? + res["X-Position"].must_equal "default.org" + + res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "any-host.org", "HTTP_X_FORWARDED_HOST" => "any-host.org") + res.must_be :ok? + res["X-Position"].must_equal "default.org" + res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "example.org:9292", "SERVER_PORT" => "9292") |