Sha256: 50b9c7b88749ddaf28beed70b0ce11648c2e2d36d5e0721e6435cce8df4a0d7e
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 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' if defined?(ActionController) && defined?(ActionController::Live) && defined?(ActionController::Live::Buffer) 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-3.8.5 | lib/contrast/rails_extensions/buffer.rb |
contrast-agent-3.8.4 | lib/contrast/rails_extensions/buffer.rb |