diff options
-rw-r--r-- | lib/rack/auth/basic.rb | 2 | ||||
-rw-r--r-- | lib/rack/request.rb | 3 | ||||
-rw-r--r-- | lib/rack/session/abstract/id.rb | 18 | ||||
-rw-r--r-- | rack.gemspec | 2 |
4 files changed, 17 insertions, 8 deletions
diff --git a/lib/rack/auth/basic.rb b/lib/rack/auth/basic.rb index dfe2ce96..95bbafc4 100644 --- a/lib/rack/auth/basic.rb +++ b/lib/rack/auth/basic.rb @@ -47,7 +47,7 @@ module Rack end def credentials - @credentials ||= params.unpack("m*").first.split(/:/, 2) + @credentials ||= params.unpack("m*").first.split(':', 2) end def username diff --git a/lib/rack/request.rb b/lib/rack/request.rb index fcdf8975..3cb27651 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -407,7 +407,8 @@ module Rack # # <tt>env['rack.input']</tt> is not touched. def delete_param(k) - [ self.POST.delete(k), self.GET.delete(k) ].compact.first + post_value, get_value = self.POST.delete(k), self.GET.delete(k) + post_value || get_value end def base_url diff --git a/lib/rack/session/abstract/id.rb b/lib/rack/session/abstract/id.rb index c9f9f458..c9258644 100644 --- a/lib/rack/session/abstract/id.rb +++ b/lib/rack/session/abstract/id.rb @@ -17,6 +17,18 @@ module Rack # SessionHash is responsible to lazily load the session from store. class SessionHash + using Module.new { + refine Hash do + def transform_keys(&block) + hash = {} + each do |key, value| + hash[block.call(key)] = value + end + hash + end + end + } unless {}.respond_to?(:transform_keys) + include Enumerable attr_writer :id @@ -162,11 +174,7 @@ module Rack end def stringify_keys(other) - hash = {} - other.each do |key, value| - hash[key.to_s] = value - end - hash + other.transform_keys(&:to_s) end end diff --git a/rack.gemspec b/rack.gemspec index 8ec7acb6..f7b13b17 100644 --- a/rack.gemspec +++ b/rack.gemspec @@ -28,7 +28,7 @@ EOF s.email = 'leah@vuxu.org' s.homepage = 'https://rack.github.io/' s.required_ruby_version = '>= 2.2.2' - s.metadata = { + s.metadata = { "bug_tracker_uri" => "https://github.com/rack/rack/issues", "changelog_uri" => "https://github.com/rack/rack/blob/master/CHANGELOG.md", "documentation_uri" => "https://rubydoc.info/github/rack/rack", |