summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-02-08 00:55:34 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-02-08 00:59:15 +1300
commitc173b188d81ee437b588c1e046a1c9f031dea550 (patch)
treeca094545e38f74cf87de2cbc71bb2a0f9e4f3035
parentd902198c067417c3e4d859910efb4861825ff82f (diff)
downloadrack-c173b188d81ee437b588c1e046a1c9f031dea550.tar.gz
Remove SERVER_ADDR.
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/rack.rb1
-rw-r--r--lib/rack/request.rb10
-rw-r--r--test/spec_request.rb6
4 files changed, 4 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 14d36e60..32d6041a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,7 @@ All notable changes to this project will be documented in this file. For info on
- Deprecation of `Rack::File`. It will be deprecated again in rack 2.2 or 3.0. ([@rafaelfranca](https://github.com/rafaelfranca))
- Support for Ruby 2.2 as it is well past EOL. ([@ioquatix](https://github.com/ioquatix))
- Remove `Rack::Files#response_body` as the implementation was broken. ([#1153](https://github.com/rack/rack/pull/1153), [@ioquatix](https://github.com/ioquatix))
+- Remove `SERVER_ADDR` which was never part of the original SPEC. ([#1573](https://github.com/rack/rack/pull/1573), [@ioquatix](https://github.com/ioquatix))
### Fixed
diff --git a/lib/rack.rb b/lib/rack.rb
index 6e86240b..e4494e5b 100644
--- a/lib/rack.rb
+++ b/lib/rack.rb
@@ -25,7 +25,6 @@ module Rack
QUERY_STRING = 'QUERY_STRING'
SERVER_PROTOCOL = 'SERVER_PROTOCOL'
SERVER_NAME = 'SERVER_NAME'
- SERVER_ADDR = 'SERVER_ADDR'
SERVER_PORT = 'SERVER_PORT'
CACHE_CONTROL = 'Cache-Control'
EXPIRES = 'Expires'
diff --git a/lib/rack/request.rb b/lib/rack/request.rb
index 6bb785c2..5191c2b3 100644
--- a/lib/rack/request.rb
+++ b/lib/rack/request.rb
@@ -228,8 +228,8 @@ module Rack
forwarded_authority || host_authority || server_authority
end
- # The authority as defined by the `SERVER_NAME`/`SERVER_ADDR` and
- # `SERVER_PORT` variables.
+ # The authority as defined by the `SERVER_NAME` and `SERVER_PORT`
+ # variables.
def server_authority
host = self.server_name
port = self.server_port
@@ -244,11 +244,7 @@ module Rack
end
def server_name
- if name = get_header(SERVER_NAME)
- name
- elsif address = get_header(SERVER_ADDR)
- wrap_ipv6(address)
- end
+ get_header(SERVER_NAME)
end
def server_port
diff --git a/test/spec_request.rb b/test/spec_request.rb
index ace8089b..0d0b2f74 100644
--- a/test/spec_request.rb
+++ b/test/spec_request.rb
@@ -136,12 +136,6 @@ class RackRequestTest < Minitest::Spec
req.host.must_equal "[2001:db8:cafe::17]"
req.hostname.must_equal "2001:db8:cafe::17"
- env = Rack::MockRequest.env_for("/", "SERVER_ADDR" => "192.168.1.1", "SERVER_PORT" => "9292")
- env.delete("SERVER_NAME")
- req = make_request(env)
- req.host.must_equal "192.168.1.1"
- req.hostname.must_equal "192.168.1.1"
-
env = Rack::MockRequest.env_for("/")
env.delete("SERVER_NAME")
req = make_request(env)