Module: Azure::Storage::Common::Core::HttpClient

Included in:
Azure::Storage::Common::Client
Defined in:
lib/azure/storage/common/core/http_client.rb

Instance Method Summary collapse

Instance Method Details

#agents(uri) ⇒ Net::HTTP

Returns the http agent based on uri

Parameters:

  • uri (URI|String)

    the base uri (scheme, host, port) of the http endpoint

Returns:

  • (Net::HTTP)

    http agent for a given uri



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/azure/storage/common/core/http_client.rb', line 32

def agents(uri)
  uri = URI(uri) unless uri.is_a? URI
  key = uri.host

  @agents ||= {}
  unless @agents.key?(key)
    @agents[key] = build_http(uri)
  else
    reuse_agent!(@agents[key])
  end
  @agents[key]
end

#reset_agents!Object

Empties all the http agents



46
47
48
# File 'lib/azure/storage/common/core/http_client.rb', line 46

def reset_agents!
  @agents = nil
end