diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-29 01:46:02 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-29 01:46:02 +0000 |
commit | d305c021cdfa3c1f3f02edfb2a7a4dc3cca898fa (patch) | |
tree | b490f549ec575cfbe57fc47d78399ddb26b1edfd /lib | |
parent | 592857f6842dbcee36119f0811d882b0f147e016 (diff) | |
download | ruby-d305c021cdfa3c1f3f02edfb2a7a4dc3cca898fa.tar.gz |
* lib/net/http/header.rb: Warn nil variable on HTTP Header.
It caused to NoMethodError. [fix GH-952][fix GH-641] Patch by @teosz
* test/net/http/test_httpheader.rb: Added test for nil HTTP Header.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/http/header.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index 3a76dcfe4c..30cdb70b91 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -15,7 +15,11 @@ module Net::HTTPHeader return unless initheader initheader.each do |key, value| warn "net/http: warning: duplicated HTTP header: #{key}" if key?(key) and $VERBOSE - @header[key.downcase] = [value.strip] + if value.nil? + warn "net/http: warning: nil HTTP header: #{key}" if $VERBOSE + else + @header[key.downcase] = [value.strip] + end end end @@ -450,4 +454,3 @@ module Net::HTTPHeader private :tokens end - |