mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cgi/core.rb: fix multipart form parsing bug. [Bug #3866]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
57da3d94aa
commit
7fd78fad3e
3 changed files with 18 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
Sat Jul 9 14:02:20 2011 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
|
||||
|
||||
* lib/cgi/core.rb: fix multipart form parsing bug. [Bug #3866]
|
||||
|
||||
Sat Jul 9 11:41:03 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/matrix.rb: Add Vector#normalize [ruby-dev:43829]
|
||||
|
|
|
@ -557,7 +557,6 @@ class CGI
|
|||
@files[name]=body
|
||||
end
|
||||
## break loop
|
||||
break if buf.size == 0
|
||||
break if content_length == -1
|
||||
end
|
||||
raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/
|
||||
|
|
|
@ -272,7 +272,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
|||
ex = assert_raise(EOFError) do
|
||||
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
||||
end
|
||||
assert_equal("bad boundary end of body part", ex.message)
|
||||
assert_equal("bad content body", ex.message)
|
||||
#
|
||||
_prepare(@data) do |input|
|
||||
input2 = input.sub(/--(\r\n)?\z/, "")
|
||||
|
@ -303,6 +303,19 @@ class CGIMultipartTest < Test::Unit::TestCase
|
|||
assert_equal('file1.html', cgi['file1'].original_filename)
|
||||
end
|
||||
|
||||
def test_cgi_multipart_boundary_10240 # [Bug #3866]
|
||||
@boundary = 'AaB03x'
|
||||
@data = [
|
||||
{:name=>'file', :value=>"b"*10134,
|
||||
:filename=>'file.txt', :content_type=>'text/plain'},
|
||||
{:name=>'foo', :value=>"bar"},
|
||||
]
|
||||
_prepare(@data)
|
||||
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
||||
assert_equal(cgi['foo'], 'bar')
|
||||
assert_equal(cgi['file'].read, 'b'*10134)
|
||||
end
|
||||
|
||||
###
|
||||
|
||||
self.instance_methods.each do |method|
|
||||
|
|
Loading…
Add table
Reference in a new issue