class Da99_Rack_Protect::Squeeze_Uri_Dots
Constants
- DOTS
- DOTS_AND_SLASHES
Public Class Methods
new(new_app)
click to toggle source
# File lib/da99_rack_protect/0020_Squeeze_Uri_Dots.rb, line 7 def initialize new_app @app = new_app end
Public Instance Methods
call(new_env)
click to toggle source
Using :REQUEST_URI includes query string
# File lib/da99_rack_protect/0020_Squeeze_Uri_Dots.rb, line 12 def call new_env old = new_env['REQUEST_URI'] new = new_env['REQUEST_URI'].gsub(DOTS_AND_SLASHES, '/'.freeze).gsub(DOTS, '.'.freeze) if new != old DA99.redirect new, 301 else @app.call new_env end end