Method: HttpUtilities::Http::ProxySupport#generate_proxy_options

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

#generate_proxy_optionsObject



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/http_utilities/http/proxy_support.rb', line 112

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