diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb index b39284ff0..a7dc265f5 100644 --- a/lib/rack/utils.rb +++ b/lib/rack/utils.rb @@ -319,7 +319,7 @@ def to_hash end def [](k) - super(@names[k] ||= @names[k.downcase]) + super(k) || super(@names[k.downcase]) end def []=(k, v) diff --git a/test/spec_utils.rb b/test/spec_utils.rb index 929f8e710..82580d138 100644 --- a/test/spec_utils.rb +++ b/test/spec_utils.rb @@ -309,6 +309,12 @@ end end + should "not create headers out of thin air" do + h = Rack::Utils::HeaderHash.new + h['foo'] + h['foo'].should.be.nil + h.should.not.include 'foo' + end end describe Rack::Utils::Context do