Sha256: 77b35245872d9fdda5d4b36ad2b4bdce1a16b5ddd5fceaf67aa31a65eae2204c

Contents?: true

Size: 782 Bytes

Versions: 24

Compression:

Stored size: 782 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}"
  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

24 entries across 24 versions & 1 rubygems

Version Path
puppet-5.5.22 lib/puppet/network/http/site.rb
puppet-5.5.22-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.22-x64-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.22-universal-darwin lib/puppet/network/http/site.rb
puppet-5.5.21 lib/puppet/network/http/site.rb
puppet-5.5.21-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.21-x64-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.21-universal-darwin lib/puppet/network/http/site.rb
puppet-5.5.20 lib/puppet/network/http/site.rb
puppet-5.5.20-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.20-x64-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.20-universal-darwin lib/puppet/network/http/site.rb
puppet-5.5.19 lib/puppet/network/http/site.rb
puppet-5.5.19-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.19-x64-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.19-universal-darwin lib/puppet/network/http/site.rb
puppet-5.5.18 lib/puppet/network/http/site.rb
puppet-5.5.18-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.4.5 lib/puppet/network/http/site.rb
puppet-5.5.18-x64-mingw32 lib/puppet/network/http/site.rb