Rewind stdin if possible after multipart parsing.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7758 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2007-10-06 09:39:31 +00:00
parent 551f6e9bee
commit 3405fb3dea
2 changed files with 4 additions and 1 deletions

View File

@@ -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

View File

@@ -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