Sha256: 61e75b6bc1e1160bfba7f32c223fd751b01950a6cf7b5377c0beaddb2944f758

Contents?: true

Size: 519 Bytes

Versions: 8

Compression:

Stored size: 519 Bytes

Contents

module JFoundry
  module ProxyOptions
    def proxy_options_for(uri)
      ssl = uri.is_a?(URI::HTTPS)
      proxy_to_use = (ssl ? https_proxy : http_proxy)

      if proxy_to_use.blank?
        []
      else
        proxy_to_use = "proto://#{proxy_to_use}" unless proxy_to_use =~ /:\/\//
        proxy_uri = URI.parse(proxy_to_use)
        proxy_user, proxy_password = proxy_uri.userinfo.split(/:/) if proxy_uri.userinfo
        [proxy_uri.host, proxy_uri.port, proxy_user, proxy_password]
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jfoundry-0.1.7 lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.6 lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.4 lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.3 lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.2 lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.1 lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.0.pre lib/jfoundry/concerns/proxy_options.rb
jfoundry-0.1.0 lib/jfoundry/concerns/proxy_options.rb