Forked from huned/monkey patch httparty to accept a timeout
Created
June 15, 2009 20:06
-
-
Save tadman/130298 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