Sha256: 25fbc4c4b9396bf076079d0a03ccd3b89a574e4e5ea6ce9a69b7bc39815108e2

Contents?: true

Size: 649 Bytes

Versions: 5

Compression:

Stored size: 649 Bytes

Contents

require 'monkeyshines/fetcher/http_fetcher'
module Monkeyshines
  module Fetcher
    #
    # Requests the HEAD only, for cases where you don't need to know actual page
    # contents (e.g. you're looking for server info or scraping URL shorteners)
    #
    class HttpHeadFetcher < HttpFetcher

      #
      # Build and dispatch request
      # We do a HEAD request only, no reason to get the body.
      #
      def perform_request url_str
        url = URI.parse(url_str)
        req = Net::HTTP::Head.new(url.send(:path_query), http_req_options)
        authenticate req
        http(url.host, url.port).request req
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
monkeyshines-0.2.3 lib/monkeyshines/fetcher/http_head_fetcher.rb
monkeyshines-0.2.2 lib/monkeyshines/fetcher/http_head_fetcher.rb
monkeyshines-0.2.1 lib/monkeyshines/fetcher/http_head_fetcher.rb
monkeyshines-0.2.0 lib/monkeyshines/fetcher/http_head_fetcher.rb
monkeyshines-0.0.2 lib/monkeyshines/fetcher/http_head_fetcher.rb