This file is indexed.

/usr/lib/ruby/vendor_ruby/remotipart/middleware.rb is in ruby-remotipart 1.2.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Remotipart

  # A middleware to look for our form parameters and 
  # encourage Rails to respond with the requested format
  class Middleware
    def initialize app
      @app = app
    end

    def call env
      # Get request params
      params = Rack::Request.new(env).params

      if params
        # This was using an iframe transport, and is therefore an XHR
        # This is required if we're going to override the http_accept
        if params['X-Requested-With'] == 'IFrame'
          env['HTTP_X_REQUESTED_WITH'] = 'xmlhttprequest'
        end

        # Override the accepted format, because it isn't what we really want
        if params['X-Http-Accept']
          env['HTTP_ACCEPT'] = params['X-Http-Accept']
        end
      end

      @app.call(env)
    end
  end
end