Sha256: 4d87e25f3b3462eac0d3afd05cd60f1ae905642f59b6ddf0f1dd371201d79d55
Contents?: true
Size: 710 Bytes
Versions: 1
Compression:
Stored size: 710 Bytes
Contents
module Rawler class Request class << self def get(url) perform_request(:get, url) end def head(url) perform_request(:head, url) end private def perform_request(method, url) uri = URI.parse(URI.encode(url)) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == 'https') http.verify_mode = OpenSSL::SSL::VERIFY_NONE path = (uri.path.size == 0) ? "/" : uri.path request = Net::HTTP::Get.new(path) request.basic_auth(Rawler.username, Rawler.password) http.request(request) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rawler-0.0.4 | lib/rawler/request.rb |