Sha256: 5c37e7f00c01c61cdb39ab7969f893605de66b02f1a8722b71186b88df81e237

Contents?: true

Size: 859 Bytes

Versions: 92

Compression:

Stored size: 859 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 self.from_uri(uri)
    self.new(uri.scheme, uri.host, uri.port)
  end

  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

92 entries across 92 versions & 1 rubygems

Version Path
puppet-6.29.0 lib/puppet/network/http/site.rb
puppet-6.29.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.29.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.29.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.28.0 lib/puppet/network/http/site.rb
puppet-6.28.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.28.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.28.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.27.0 lib/puppet/network/http/site.rb
puppet-6.27.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.27.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.27.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.26.0 lib/puppet/network/http/site.rb
puppet-6.26.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.26.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.26.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.25.1 lib/puppet/network/http/site.rb
puppet-6.25.1-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.25.1-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.25.1-universal-darwin lib/puppet/network/http/site.rb