/usr/lib/ruby/vendor_ruby/rack/attack/path_normalizer.rb is in ruby-rack-attack 4.4.1-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 | class Rack::Attack
# When using Rack::Attack with a Rails app, developers expect the request path
# to be normalized. In particular, trailing slashes are stripped.
# (See http://git.io/v0rrR for implementation.)
#
# Look for an ActionDispatch utility class that Rails folks would expect
# to normalize request paths. If unavailable, use a fallback class that
# doesn't normalize the path (as a non-Rails rack app developer expects).
module FallbackPathNormalizer
def self.normalize_path(path)
path
end
end
PathNormalizer = if defined?(::ActionDispatch::Journey::Router::Utils)
# For Rails 4+ apps
::ActionDispatch::Journey::Router::Utils
elsif defined?(::Journey::Router::Utils)
# for Rails 3.2
::Journey::Router::Utils
else
FallbackPathNormalizer
end
end
|