Sha256: b133c7403f4dd65d6f26a21581de3b015aa55a5de75e4de7cd6d66eeaa43f6cc
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true cs__scoped_require 'contrast/components/interface' module ActionController module Live # This class acts as our patch into the ActionController::Live::Buffer # class, allowing us to track the close event on streamed responses. class Buffer include Contrast::Components::Interface access_component :contrast_service # normally pre->in->post filters are applied however, in a streamed response # we can run into a case where it's pre -> in -> post -> more infilters # in order to submit anything found during the infilters after the response has been written we need to explicity send them alias_method :cs__close, :close def close if (context = Contrast::Agent::REQUEST_TRACKER.current) [context.server_activity, context.activity, context.observed_route].each do |msg| CONTRAST_SERVICE.send_message msg end end cs__close end end end end
Version data entries
6 entries across 6 versions & 1 rubygems