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

* 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
This commit is contained in:
shugo 2016-07-06 00:01:20 +00:00
parent 8686ce2b42
commit 554c879f1f
3 changed files with 19 additions and 1 deletions

View file

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