Class: HTTParty::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/spider/httparty_patch.rb

Instance Method Summary collapse

Instance Method Details

#httpObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/spider/httparty_patch.rb', line 12

def http
  http = Net::HTTP.new(
    uri.host,
    uri.port,
    options[:http_proxyaddr],
    options[:http_proxyport],
    options[:http_proxyuser],
    options[:http_proxypassword]
  )
  http.use_ssl = ssl_implied?

  if options[:timeout] && (options[:timeout].is_a?(Integer) || options[:timeout].is_a?(Float))
    http.open_timeout = options[:timeout]
  end   

  attach_ssl_certificates(http)

  if options[:debug_output]
    http.set_debug_output(options[:debug_output])
  end 

  http
end