This file is indexed.

/usr/lib/ruby/vendor_ruby/rack/rewrite.rb is in ruby-rack-rewrite 1.3.3-1.

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
module Rack
  autoload :RuleSet, 'rack/rewrite/rule'
  autoload :VERSION, 'rack/rewrite/version'
  
  # A rack middleware for defining and applying rewrite rules. In many cases you 
  # can get away with rack-rewrite instead of writing Apache mod_rewrite rules.  
  class Rewrite
    def initialize(app, &rule_block)
      @app = app
      @rule_set = RuleSet.new
      @rule_set.instance_eval(&rule_block) if block_given?
    end
    
    def call(env)
      if matched_rule = find_first_matching_rule(env)
        rack_response = matched_rule.apply!(env)
        # Don't invoke the app if applying the rule returns a rack response
        return rack_response unless rack_response === true
      end
      @app.call(env)
    end
        
    private
      def find_first_matching_rule(env) #:nodoc:
        @rule_set.rules.detect { |rule| rule.matches?(env) }
      end    
  end
end