aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/rack/multipart.rb
blob: 3b142307e9137e5017c2099601244818ae0ddade (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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