Method: LibGems::RemoteFetcher#initialize

Defined in:
lib/libgems/remote_fetcher.rb

#initialize(proxy = nil) ⇒ RemoteFetcher

Initialize a remote fetcher using the source URI and possible proxy information.

proxy

  • [String]: explicit specification of proxy; overrides any environment

    variable setting
    
  • nil: respect environment variables (HTTP_PROXY, HTTP_PROXY_USER,

    HTTP_PROXY_PASS)
    
  • :no_proxy: ignore environment variables and _don’t_ use a proxy



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/libgems/remote_fetcher.rb', line 58

def initialize(proxy = nil)
  Socket.do_not_reverse_lookup = true

  @connections = {}
  @requests = Hash.new 0
  @proxy_uri =
    case proxy
    when :no_proxy then nil
    when nil then get_proxy_from_env
    when URI::HTTP then proxy
    else URI.parse(proxy)
    end
end