aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-06 09:39:31 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-06 09:39:31 +0000
commit3405fb3deab217d613b9584dba71da754e1dc7a9 (patch)
treed8120c8c934595c7c0fd1a59edada1fd2cc607fa
parent551f6e9beec301e288c1a6d253cfa5a08f609238 (diff)
downloadrails-3405fb3deab217d613b9584dba71da754e1dc7a9.tar.gz
rails-3405fb3deab217d613b9584dba71da754e1dc7a9.tar.bz2
rails-3405fb3deab217d613b9584dba71da754e1dc7a9.zip
Rewind stdin if possible after multipart parsing.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7758 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-xactionpack/lib/action_controller/request.rb1
-rw-r--r--actionpack/test/controller/request_test.rb4
2 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb
index 68a5ea3701..e9a2e797dd 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -598,6 +598,7 @@ module ActionController
end
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
+ body.rewind if body.respond_to?(:rewind)
params
end
end
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index 1bb01ffd00..c62b2a6ec7 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -719,7 +719,9 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
private
def process(name)
File.open(File.join(FIXTURE_PATH, name), 'rb') do |file|
- ActionController::AbstractRequest.parse_multipart_form_parameters(file, 'AaB03x', file.stat.size, {})
+ params = ActionController::AbstractRequest.parse_multipart_form_parameters(file, 'AaB03x', file.stat.size, {})
+ assert_equal 0, file.pos # file was rewound after reading
+ params
end
end
end