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:
parent
8686ce2b42
commit
554c879f1f
3 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jul 6 08:59:35 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/http/generic_rquest.rb (write_header): A Request-Line must
|
||||||
|
not contain CR or LF.
|
||||||
|
|
||||||
Wed Jul 6 07:11:27 2016 Shugo Maeda <shugo@ruby-lang.org>
|
Wed Jul 6 07:11:27 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* lib/net/ftp.rb (putline): raise an ArgumentError when
|
* lib/net/ftp.rb (putline): raise an ArgumentError when
|
||||||
|
|
|
@ -321,7 +321,12 @@ class Net::HTTPGenericRequest
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_header(sock, ver, path)
|
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|
|
each_capitalized do |k,v|
|
||||||
buf << "#{k}: #{v}\r\n"
|
buf << "#{k}: #{v}\r\n"
|
||||||
end
|
end
|
||||||
|
|
|
@ -315,6 +315,14 @@ module TestNetHTTP_version_1_1_methods
|
||||||
assert_equal $test_net_http_data, res.body
|
assert_equal $test_net_http_data, res.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get__crlf
|
||||||
|
start {|http|
|
||||||
|
assert_raise(ArgumentError) do
|
||||||
|
http.get("\r")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def test_get2
|
def test_get2
|
||||||
start {|http|
|
start {|http|
|
||||||
http.get2('/') {|res|
|
http.get2('/') {|res|
|
||||||
|
|
Loading…
Reference in a new issue