Method: HttpUtilities::Http::ProxySupport#generate_proxy_options

Defined in:
lib/http_utilities/http/proxy_support.rb

#generate_proxy_optionsObject



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/http_utilities/http/proxy_support.rb', line 81

def generate_proxy_options
  proxy_options               =   {}
  
  if self.proxy && !self.proxy[:host].to_s.empty? && !self.proxy[:port].to_s.empty?
    proxy_options[:uri]       =   "http://#{self.proxy[:host]}:#{self.proxy[:port]}"
    proxy_options[:user]      =   self.proxy[:username] if !self.proxy[:username].to_s.empty?
    proxy_options[:password]  =   self.proxy[:password] if !self.proxy[:password].to_s.empty?
  end
  
  return proxy_options
end