Sha256: e4fdcac2e9e1707bc7f214e8dcc6d8a62f122d4163f14c31860db0036fc4d099

Contents?: true

Size: 955 Bytes

Versions: 81

Compression:

Stored size: 955 Bytes

Contents

require 'katello/util/proxy_uri'

module Katello
  module Util
    module HttpProxy
      def proxy_uri
        #Reset the scheme to proxy(s) based on http or https to handle cgi unescaping in rest-client
        # this relies on katello/util/proxy_uri
        if proxy
          scheme = 'proxy' if proxy_scheme == 'http'
          scheme = 'proxys' if proxy_scheme == 'https'

          uri = URI("#{scheme}://#{proxy_host}:#{proxy_port}")
          if proxy && proxy.username.present?
            uri.user = CGI.escape(proxy.username)
            uri.password = CGI.escape(proxy.password)
          end

          uri.to_s
        end
      end

      def proxy
        ::HttpProxy.default_global_content_proxy
      end

      def proxy_host
        URI(proxy.url).host
      end

      def proxy_scheme
        URI(proxy.url).scheme
      end

      def proxy_port
        URI(proxy.url).port
      end
    end # HttpProxy
  end # Util
end # Katello

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
katello-4.1.4 app/lib/katello/util/http_proxy.rb
katello-4.0.3 app/lib/katello/util/http_proxy.rb
katello-3.18.5 app/lib/katello/util/http_proxy.rb
katello-4.1.3 app/lib/katello/util/http_proxy.rb
katello-4.0.2.1 app/lib/katello/util/http_proxy.rb
katello-4.1.2.1 app/lib/katello/util/http_proxy.rb
katello-4.0.2 app/lib/katello/util/http_proxy.rb
katello-4.1.2 app/lib/katello/util/http_proxy.rb
katello-3.18.4 app/lib/katello/util/http_proxy.rb
katello-4.1.1 app/lib/katello/util/http_proxy.rb
katello-4.1.0 app/lib/katello/util/http_proxy.rb
katello-4.0.1.2 app/lib/katello/util/http_proxy.rb
katello-3.18.3.1 app/lib/katello/util/http_proxy.rb
katello-4.1.0.rc2.2 app/lib/katello/util/http_proxy.rb
katello-4.1.0.rc2.1 app/lib/katello/util/http_proxy.rb
katello-4.0.1.1 app/lib/katello/util/http_proxy.rb
katello-3.18.3 app/lib/katello/util/http_proxy.rb
katello-4.1.0.rc2 app/lib/katello/util/http_proxy.rb
katello-4.0.1 app/lib/katello/util/http_proxy.rb
katello-4.1.0.rc1.1 app/lib/katello/util/http_proxy.rb