Sha256: 15fbddce20576e7d5ed8358095f6577297dbb2d7f8230c36aa49b8e56241099d

Contents?: true

Size: 676 Bytes

Versions: 9

Compression:

Stored size: 676 Bytes

Contents

module Relevance
  module Tarantula

    class InvalidHtmlHandler
      include Relevance::Tarantula
      def handle(result)
        response = result.response
        unless response.html?
          log "Skipping #{self.class} on url: #{result.url} because response is not html."
          return
        end
        begin
          body = HTML::Document.new(response.body, true)
        rescue Exception => e
          error_result = result.dup
          error_result.success = false
          error_result.description = "Bad HTML (Scanner)"
          error_result.data = e.message
          error_result
        else
          nil
        end
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
codez-tarantula-0.5.5 lib/relevance/tarantula/invalid_html_handler.rb
codez-tarantula-0.5.4 lib/relevance/tarantula/invalid_html_handler.rb
codez-tarantula-0.5.3 lib/relevance/tarantula/invalid_html_handler.rb
codez-tarantula-0.5.1 lib/relevance/tarantula/invalid_html_handler.rb
codez-tarantula-0.5.0 lib/relevance/tarantula/invalid_html_handler.rb
tarantula-0.5.1 lib/relevance/tarantula/invalid_html_handler.rb
tarantula-0.5.0 lib/relevance/tarantula/invalid_html_handler.rb
tarantula-0.4.3 lib/relevance/tarantula/invalid_html_handler.rb
tarantula-0.4.2 lib/relevance/tarantula/invalid_html_handler.rb