From db885e81b9dc918a75bd66b1631a13e10447d0ff Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 7 Dec 2007 04:20:20 +0000 Subject: Ignore illegal seeks on body rewind. Catches CGI errors depending on your httpd. Closes #10404 [Curtis Hawthorne] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/request_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/test/controller/request_test.rb') diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 1ae1f975a0..76c8604c50 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -736,6 +736,16 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase assert ('a' * 20480) == file.read end + uses_mocha "test_no_rewind_stream" do + def test_no_rewind_stream + # Ensures that parse_multipart_form_parameters works with streams that cannot be rewound + file = File.open(File.join(FIXTURE_PATH, 'large_text_file'), 'rb') + file.expects(:rewind).raises(Errno::ESPIPE) + params = ActionController::AbstractRequest.parse_multipart_form_parameters(file, 'AaB03x', file.stat.size, {}) + assert_not_equal 0, file.pos # file was not rewound after reading + end + end + def test_binary_file params = process('binary_file') assert_equal %w(file flowers foo), params.keys.sort -- cgit v1.2.3