mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
merge revision(s) 55581,55582: [Backport #12557]
* 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/branches/ruby_2_2@55874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9bfab3c125
commit
26df8ea5bb
4 changed files with 23 additions and 2 deletions
|
@ -320,7 +320,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue