diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-01-13 17:21:45 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-13 17:21:45 -0600 |
commit | 9775c25824feb35a5c42f3838d21c7e5faba9ca0 (patch) | |
tree | afbb65ffadbd8d16d5ed787aa3c95553e059f322 /actionpack/lib/action_controller/rack_ext.rb | |
parent | 1adc1496f9152c893e1f08abcb1e5e7272829899 (diff) | |
download | rails-9775c25824feb35a5c42f3838d21c7e5faba9ca0.tar.gz rails-9775c25824feb35a5c42f3838d21c7e5faba9ca0.tar.bz2 rails-9775c25824feb35a5c42f3838d21c7e5faba9ca0.zip |
Update multipart tests to expose (another) bug in Rack's multipart parser
Diffstat (limited to 'actionpack/lib/action_controller/rack_ext.rb')
-rw-r--r-- | actionpack/lib/action_controller/rack_ext.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/rack_ext.rb b/actionpack/lib/action_controller/rack_ext.rb new file mode 100644 index 0000000000..3b142307e9 --- /dev/null +++ b/actionpack/lib/action_controller/rack_ext.rb @@ -0,0 +1,22 @@ +module Rack + module Utils + module Multipart + class << self + def parse_multipart_with_rewind(env) + result = parse_multipart_without_rewind(env) + + begin + env['rack.input'].rewind if env['rack.input'].respond_to?(:rewind) + rescue Errno::ESPIPE + # Handles exceptions raised by input streams that cannot be rewound + # such as when using plain CGI under Apache + end + + result + end + + alias_method_chain :parse_multipart, :rewind + end + end + end +end |