diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-02-08 00:25:19 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-02-08 00:52:30 +1300 |
commit | 997ce7f6c00e0756104b40dc1da5b8b82077d66b (patch) | |
tree | d5a1286a93dec2b39ceecc503bf268fb87d631d0 | |
parent | c72901d7c6c63f89888dd48ab01c184d0edcfe66 (diff) | |
download | rack-997ce7f6c00e0756104b40dc1da5b8b82077d66b.tar.gz |
Document AUTHORITY regexp.
-rw-r--r-- | lib/rack/request.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/rack/request.rb b/lib/rack/request.rb index 6e994d5e..58ee5683 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -403,6 +403,7 @@ module Rack def form_data? type = media_type meth = get_header(RACK_METHODOVERRIDE_ORIGINAL_METHOD) || get_header(REQUEST_METHOD) + (meth == POST && type.nil?) || FORM_DATA_MEDIA_TYPES.include?(type) end @@ -588,7 +589,22 @@ module Rack value ? value.strip.split(/[,\s]+/) : [] end - AUTHORITY = /(?<host>(\[(?<ip6>.*)\])|(?<ip4>[\d\.]+)|(?<name>[a-zA-Z0-9\.\-]+))(:(?<port>\d+))?/ + AUTHORITY = / + # The host: + (?<host> + # An IPv6 address: + (\[(?<ip6>.*)\]) + | + # An IPv4 address: + (?<ip4>[\d\.]+) + | + # A hostname: + (?<name>[a-zA-Z0-9\.\-]+) + ) + # The optional port: + (:(?<port>\d+))? + /x + private_constant :AUTHORITY def split_authority(authority) |