Created
June 11, 2009 22:25
-
-
Save huned/128273 to your computer and use it in GitHub Desktop.
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 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment