Sha256: 6c0caea71d56511cd4ac2512dfbe9fe4303df2bb59548374fb9e86b503e7a323

Contents?: true

Size: 697 Bytes

Versions: 20

Compression:

Stored size: 697 Bytes

Contents

module ActionDispatch
  module Http
    module FilterRedirect
      FILTERED = "[FILTERED]".freeze # :nodoc:

      def filtered_location # :nodoc:
        if location_filter_match?
          FILTERED
        else
          location
        end
      end

    private

      def location_filters
        if request
          request.get_header("action_dispatch.redirect_filter") || []
        else
          []
        end
      end

      def location_filter_match?
        location_filters.any? do |filter|
          if String === filter
            location.include?(filter)
          elsif Regexp === filter
            location =~ filter
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
actionpack-5.1.7 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.7.rc1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.6.2 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.6.1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.6 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.5 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.5.rc1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.4 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.4.rc1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.3 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.3.rc3 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.3.rc2 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.3.rc1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.2 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.2.rc1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.0 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.0.rc2 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.0.rc1 lib/action_dispatch/http/filter_redirect.rb
actionpack-5.1.0.beta1 lib/action_dispatch/http/filter_redirect.rb