diff options
Diffstat (limited to 'lib')
-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 00ff434ccf..959a3c6510 100644 --- a/lib/net/http/generic_request.rb +++ b/lib/net/http/generic_request.rb @@ -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 |