Sha256: 93dac805aec275dfeacb8cfaa630e375e36fa1d7f2cbd93d6c3ff395e6996b15

Contents?: true

Size: 721 Bytes

Versions: 32

Compression:

Stored size: 721 Bytes

Contents

module Puppet::Util::HttpProxy

  def self.http_proxy_env
    # Returns a URI object if proxy is set, or nil
    proxy_env = ENV["http_proxy"] || ENV["HTTP_PROXY"]
    begin
      return URI.parse(proxy_env) if proxy_env
    rescue URI::InvalidURIError
      return nil
    end
    return nil
  end

  def self.http_proxy_host
    env = self.http_proxy_env

    if env and env.host then
      return env.host
    end

    if Puppet.settings[:http_proxy_host] == 'none'
      return nil
    end

    return Puppet.settings[:http_proxy_host]
  end

  def self.http_proxy_port
    env = self.http_proxy_env

    if env and env.port then
      return env.port
    end

    return Puppet.settings[:http_proxy_port]
  end

end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
puppet-3.4.1 lib/puppet/util/http_proxy.rb
puppet-3.4.0 lib/puppet/util/http_proxy.rb
puppet-3.4.0.rc2 lib/puppet/util/http_proxy.rb
puppet-3.4.0.rc1 lib/puppet/util/http_proxy.rb
puppet-3.3.2 lib/puppet/util/http_proxy.rb
puppet-3.3.1 lib/puppet/util/http_proxy.rb
puppet-3.3.1.rc3 lib/puppet/util/http_proxy.rb
puppet-3.3.1.rc2 lib/puppet/util/http_proxy.rb
puppet-3.3.1.rc1 lib/puppet/util/http_proxy.rb
puppet-3.3.0 lib/puppet/util/http_proxy.rb
puppet-3.3.0.rc3 lib/puppet/util/http_proxy.rb
puppet-3.3.0.rc2 lib/puppet/util/http_proxy.rb