Sha256: a53f1fce8cb8d07aaed1b2da9d25d74a95fba508b7004b9e5c2a37ac1029b956
Contents?: true
Size: 991 Bytes
Versions: 24
Compression:
Stored size: 991 Bytes
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.io/terms.html module Sqreen class Middleware def initialize(app) @app = app end def call(env) @app.call(env) end end class ErrorHandlingMiddleware def initialize(app) @app = app end def call(env) @app.call(env) rescue => e sqreen_attack = nil if e.is_a?(Sqreen::AttackBlocked) sqreen_attack = e elsif e.respond_to?(:original_exception) && e.original_exception.is_a?(Sqreen::AttackBlocked) sqreen_attack = e.original_exception end if sqreen_attack && sqreen_attack.redirect_url return [303, { 'Location' => sqreen_attack.redirect_url }, ['']] else raise end end end class RailsMiddleware def initialize(app) @app = app end def call(env) @app.call(env) end end end
Version data entries
24 entries across 24 versions & 1 rubygems