Sha256: f4c93f0bbabff70144b633d6c99e90a789a6aaf781b0353730c51eb3a073e2f6

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module Geokit
  module NetAdapter
    class NetHttp
      def self.do_get(url)
        uri = URI.parse(url)
        req = Net::HTTP::Get.new(url)
        req.basic_auth(uri.user, uri.password) if uri.userinfo
        net_http_args = [uri.host, uri.port]
        if (proxy_uri_string = Geokit::Geocoders::proxy)
          proxy_uri = URI.parse(proxy_uri_string)
          net_http_args += [proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password]
        end
        Net::HTTP::new(*net_http_args).start { |http| http.request(req) }
      end

      def self.success?(response)
        response.is_a?(Net::HTTPSuccess)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geokit-1.8.4 lib/geokit/net_adapter/net_http.rb