aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-28 19:55:31 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-28 19:55:31 +0000
commit388e5d3fac146ee10b636aca195620c562cdb522 (patch)
tree73bdc787182ef9b8b76d8ef91ba7bff8fc9fa3c9 /actionpack
parent4aca503d0e7595efde10e5b225eb11937693b117 (diff)
downloadrails-388e5d3fac146ee10b636aca195620c562cdb522.tar.gz
rails-388e5d3fac146ee10b636aca195620c562cdb522.tar.bz2
rails-388e5d3fac146ee10b636aca195620c562cdb522.zip
Fixed that ActionController::Base#read_multipart would fail if boundary was exactly 10240 bytes (closes #10886) [ariejan]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/request.rb1
-rw-r--r--actionpack/test/controller/request_test.rb21
3 files changed, 22 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 0c18ec14b1..9a72737c37 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that ActionController::Base#read_multipart would fail if boundary was exactly 10240 bytes #10886 [ariejan]
+
* Fixed HTML::Tokenizer (used in sanitize helper) didn't handle unclosed CDATA tags #10071 [esad, packagethief]
* Improve documentation. [Radar, Jan De Poorter, chuyeow, xaviershay, danger, miloops, Xavier Noria, Sunny Ripert]
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb
index d817004398..4889d296ef 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -585,7 +585,6 @@ module ActionController
else
params[name] = [content]
end
- break if buf.size == 0
break if content_length == -1
end
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index a12b929477..2f72f9017a 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -601,7 +601,7 @@ class UrlEncodedRequestParameterParsingTest < Test::Unit::TestCase
"ie_products[string]" => [ UploadedStringIO.new("Microsoft") ],
"ie_products[file]" => [ ie_file ],
"text_part" => [non_file_text_part]
- }
+ }
expected_output = {
"something" => "",
@@ -744,6 +744,25 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
assert_equal 'contents', file.read
end
+ def test_boundary_problem_file
+ params = process('boundary_problem_file')
+ assert_equal %w(file foo), params.keys.sort
+
+ file = params['file']
+ foo = params['foo']
+
+ if RUBY_VERSION > '1.9'
+ assert_kind_of File, file
+ else
+ assert_kind_of Tempfile, file
+ end
+
+ assert_equal 'file.txt', file.original_filename
+ assert_equal "text/plain", file.content_type
+
+ assert_equal 'bar', foo
+ end
+
def test_large_text_file
params = process('large_text_file')
assert_equal %w(file foo), params.keys.sort