diff options
-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) |