Sha256: 52e9cc33c764305c15fddc5deb79471bc84cba6d7f442d8464d0b902f296dc8c
Contents?: true
Size: 760 Bytes
Versions: 9
Compression:
Stored size: 760 Bytes
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html require 'sqreen/attack_blocked' module Sqreen class ErrorHandlingMiddleware def initialize(app) @app = app end def call(env) @app.call(env) rescue StandardError => 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 }, ['']] end raise end end end
Version data entries
9 entries across 9 versions & 1 rubygems