1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
hsbt 2016-01-29 01:46:02 +00:00
parent 0897a6df5e
commit 809d3770e6
3 changed files with 17 additions and 2 deletions

View file

@ -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