Sha256: e0b9fbaf56d4acbc32d95559633b561f065b5cd0fe3755862c4d97186664bd9e

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 Bytes

Contents

require 'httpclient'

module Geminabox

  class HttpClientAdapter < HttpAdapter

    def get(*args)
      http_client.get(*args)
    end

    def get_content(*args)
      http_client.get_content(*args)
    end

    def post(*args)
      http_client.post(*args)
    end

    def set_auth(url, username = nil, password = nil)
      http_client.set_auth(url, username, password) if username or password
      http_client.www_auth.basic_auth.challenge(url) # Workaround: https://github.com/nahi/httpclient/issues/63
      http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
      http_client.send_timeout = 0
      http_client.receive_timeout = 0
    end

    def http_client
      @http_client ||= HTTPClient.new(ENV['http_proxy'])
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
geminabox-0.13.0 lib/geminabox/http_adapter/http_client_adapter.rb
r5_geminabox-0.0.1 lib/geminabox/http_adapter/http_client_adapter.rb
geminabox-0.12.4 lib/geminabox/http_adapter/http_client_adapter.rb