Sha256: 4d2026df4faf238e14c994c6767fbc608f0ed7916319c2cf96e1dc6da0402900

Contents?: true

Size: 699 Bytes

Versions: 63

Compression:

Stored size: 699 Bytes

Contents

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.io/terms.html

require 'sqreen/rules_callbacks/matcher_rule'
require 'sqreen/frameworks'

module Sqreen
  module Rules
    # FIXME: Factor with UserAgentMatchesCB
    # Look for crawlers
    class CrawlerUserAgentMatchesCB < MatcherRuleCB
      def pre(_inst, *_args, &_block)
        ua = framework.client_user_agent
        return unless ua
        found = match(ua)
        return unless found
        Sqreen.log.debug { "Found UA #{ua} - found: #{found}" }
        infos = { :found => found }
        record_event(infos)
        advise_action(nil)
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 2 rubygems

Version Path
sqreen-1.11.0-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.11.0 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.11.0 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.5-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.10.5 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.5 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.4-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.10.4 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.4 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.3-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.10.3 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.3 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.2-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.10.2 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.2 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.1-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.10.1 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.1 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-1.10.0-java lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb
sqreen-alt-1.10.0 lib/sqreen/rules_callbacks/crawler_user_agent_matches.rb