diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-02-06 20:38:41 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-02-08 00:52:30 +1300 |
commit | 2266e086b665e086295450a33ae0abcda0868453 (patch) | |
tree | bd08d3f2cb66add0ba539bc22a3780d0a440c5c5 | |
parent | 77331cdf02410d3531b326a42ec734fd6e7437f6 (diff) | |
download | rack-2266e086b665e086295450a33ae0abcda0868453.tar.gz |
Add entry to CHANGELOG, minor improvements as discussed.
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | lib/rack/lint.rb | 14 | ||||
-rw-r--r-- | lib/rack/request.rb | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 47bdbfd8..14d36e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. For info on - `rack.session` request environment entry must respond to `to_hash` and return unfrozen Hash. ([@jeremyevans](https://github.com/jeremyevans)) - Request environment cannot be frozen. ([@jeremyevans](https://github.com/jeremyevans)) - CGI values in the request environment with non-ASCII characters must use ASCII-8BIT encoding. ([@jeremyevans](https://github.com/jeremyevans)) +- Improve SPEC/lint relating to SERVER_NAME, SERVER_PORT and HTTP_HOST. ([#1561](https://github.com/rack/rack/pull/1561), [@ioquatix](https://github.com/ioquatix)) ### Added @@ -40,7 +41,7 @@ All notable changes to this project will be documented in this file. For info on - `Rack::HeaderHash` is memoized by default. ([#1549](https://github.com/rack/rack/pull/1549), [@ioquatix](https://github.com/ioquatix)) - `Rack::Directory` allow directory traversal inside root directory. ([#1417](https://github.com/rack/rack/pull/1417), [@ThomasSevestre](https://github.com/ThomasSevestre)) - Sort encodings by server preference. ([#1184](https://github.com/rack/rack/pull/1184), [@ioquatix](https://github.com/ioquatix), [@wjordan](https://github.com/wjordan)) -- Rework host/hostname/authority implementation in `Rack::Request`. ([#1561](https://github.com/rack/rack/pull/1561), [@ioquatix](https://github.com/ioquatix)) +- Rework host/hostname/authority implementation in `Rack::Request`. `#host` and `#host_with_port` have been changed to correctly return IPv6 addresses formatted with square brackets, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-3.2.2). ([#1561](https://github.com/rack/rack/pull/1561), [@ioquatix](https://github.com/ioquatix)) ### Removed diff --git a/lib/rack/lint.rb b/lib/rack/lint.rb index 5349034e..bc5b7f50 100644 --- a/lib/rack/lint.rb +++ b/lib/rack/lint.rb @@ -117,17 +117,19 @@ module Rack ## follows the <tt>?</tt>, if any. May be ## empty, but is always required! - ## <tt>SERVER_NAME</tt>, <tt>SERVER_PORT</tt>:: - ## When combined with <tt>SCRIPT_NAME</tt> and + ## <tt>SERVER_NAME</tt>:: When combined with <tt>SCRIPT_NAME</tt> and ## <tt>PATH_INFO</tt>, these variables can be ## used to complete the URL. Note, however, ## that <tt>HTTP_HOST</tt>, if present, ## should be used in preference to ## <tt>SERVER_NAME</tt> for reconstructing ## the request URL. - ## <tt>SERVER_NAME</tt> and <tt>SERVER_PORT</tt> - ## can never be empty strings, and so - ## are always required. + ## <tt>SERVER_NAME</tt> can never be an empty + ## string, and so is always required. + + ## <tt>SERVER_PORT</tt>:: An optional +Integer+ which is the port the + ## server is running on. Should be specified if + ## the server is running on a non-standard port. ## <tt>HTTP_</tt> Variables:: Variables corresponding to the ## client-supplied HTTP request @@ -280,7 +282,7 @@ module Rack ## The <tt>SERVER_PORT</tt> must be an integer if set. assert("env[SERVER_PORT] is not an integer") do server_port = env["SERVER_PORT"] - server_port.nil? || (Integer(server_port) rescue false) + server_port.nil? || server_port.is_a?(Integer) end ## The <tt>SERVER_NAME</tt> must be a valid authority as defined by RFC7540. diff --git a/lib/rack/request.rb b/lib/rack/request.rb index e9e5b850..3f4be72c 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -219,7 +219,7 @@ module Rack end end - # The authority of the incoming reuqest as defined by RFC2976. + # The authority of the incoming request as defined by RFC3976. # https://tools.ietf.org/html/rfc3986#section-3.2 # # In HTTP/1, this is the `host` header. |