Sha256: ba5a89e70ea5cc826be645837ea19aa8346804a5413e60eb9bc705b1c525b484

Contents?: true

Size: 787 Bytes

Versions: 465

Compression:

Stored size: 787 Bytes

Contents

# Represents a site to which HTTP connections are made. It is a value
# object, and is suitable for use in a hash. If two sites are equal,
# then a persistent connection made to the first site, can be re-used
# for the second.
#
# @api private
#
class Puppet::Network::HTTP::Site
  attr_reader :scheme, :host, :port

  def initialize(scheme, host, port)
    @scheme = scheme
    @host = host
    @port = port.to_i
  end

  def addr
    "#{@scheme}://#{@host}:#{@port.to_s}"
  end
  alias to_s addr

  def ==(rhs)
    (@scheme == rhs.scheme) && (@host == rhs.host) && (@port == rhs.port)
  end

  alias eql? ==

  def hash
    [@scheme, @host, @port].hash
  end

  def use_ssl?
    @scheme == 'https'
  end

  def move_to(uri)
    self.class.new(uri.scheme, uri.host, uri.port)
  end
end

Version data entries

465 entries across 465 versions & 3 rubygems

Version Path
puppet-5.5.17-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.17 lib/puppet/network/http/site.rb
puppet-6.10.1 lib/puppet/network/http/site.rb
puppet-5.5.17-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.10.1-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.17-universal-darwin lib/puppet/network/http/site.rb
puppet-6.10.1-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.10.1-universal-darwin lib/puppet/network/http/site.rb
puppet-6.4.4 lib/puppet/network/http/site.rb
puppet-6.4.4-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.4.4-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.4.4-universal-darwin lib/puppet/network/http/site.rb
puppet-6.10.0 lib/puppet/network/http/site.rb
puppet-6.10.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.10.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.10.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.9.0 lib/puppet/network/http/site.rb
puppet-6.9.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.9.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.9.0-universal-darwin lib/puppet/network/http/site.rb