This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monkey patch HTTParty to use a configurable timeout | |
module HTTParty | |
class Request | |
private | |
def http | |
http = Net::HTTP.new(uri.host, uri.port, options[:http_proxyaddr], options[:http_proxyport]) | |
http.use_ssl = (uri.port == 443) | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
http.open_timeout = http.read_timeout = options[:timeout].to_i if options[:timeout].to_i > 0 | |
http |