diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-06 00:01:20 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-06 00:01:20 +0000 |
commit | 554c879f1f0138a3981b9245b397a1a969461c7b (patch) | |
tree | 4a534146320afd168a4600c91e9ceb06316560e3 /lib/net/http/generic_request.rb | |
parent | 8686ce2b42264a97d203fb7e638f549ed68a8934 (diff) | |
download | ruby-554c879f1f0138a3981b9245b397a1a969461c7b.tar.gz |
* lib/net/http/generic_rquest.rb (write_header): A Request-Line must
not contain CR or LF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http/generic_request.rb')
-rw-r--r-- | lib/net/http/generic_request.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb index 19602da27c..6c5ceafe61 100644 --- a/lib/net/http/generic_request.rb +++ b/lib/net/http/generic_request.rb @@ -321,7 +321,12 @@ class Net::HTTPGenericRequest end def write_header(sock, ver, path) - buf = "#{@method} #{path} HTTP/#{ver}\r\n" + reqline = "#{@method} #{path} HTTP/#{ver}" + if /[\r\n]/ =~ reqline + raise ArgumentError, "A Request-Line must not contain CR or LF" + end + buf = "" + buf << reqline << "\r\n" each_capitalized do |k,v| buf << "#{k}: #{v}\r\n" end |