Sha256: 62c39820220cdbb82ef604cb6ad4600151fcde38a4c1e895c4fd700fc9ba2846

Contents?: true

Size: 650 Bytes

Versions: 6

Compression:

Stored size: 650 Bytes

Contents

module WPScan
  # HTTP Error
  class HTTPError < Error
    attr_reader :response

    # @param [ Typhoeus::Response ] res
    def initialize(response)
      @response = response
    end

    def failure_details
      msg = response.effective_url

      msg += if response.code.zero? || response.timed_out?
               " (#{response.return_message})"
             else
               " (status: #{response.code})"
             end

      msg
    end

    def to_s
      "HTTP Error: #{failure_details}"
    end
  end

  # Used in the Updater
  class DownloadError < HTTPError
    def to_s
      "Unable to get #{failure_details}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wpscan-3.4.5 lib/wpscan/errors/http.rb
wpscan-3.4.4 lib/wpscan/errors/http.rb
wpscan-3.4.3 lib/wpscan/errors/http.rb
wpscan-3.4.2 lib/wpscan/errors/http.rb
wpscan-3.4.1 lib/wpscan/errors/http.rb
wpscan-3.4.0 lib/wpscan/errors/http.rb