Permalink
Browse files

Rewind stdin if possible after multipart parsing.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7758 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 551f6e9 commit 3405fb3deab217d613b9584dba71da754e1dc7a9 @jeremy jeremy committed Oct 6, 2007
Showing with 4 additions and 1 deletion.
  1. +1 −0 actionpack/lib/action_controller/request.rb
  2. +3 −1 actionpack/test/controller/request_test.rb
@@ -598,6 +598,7 @@ def read_multipart(body, boundary, content_length, env)
end
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
+ body.rewind if body.respond_to?(:rewind)
params
end
end
@@ -719,7 +719,9 @@ def test_mixed_files
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

0 comments on commit 3405fb3

Please sign in to comment.