lib/onering/api.rb in onering-client-0.0.26 vs lib/onering/api.rb in onering-client-0.0.27
- old
+ new
@@ -9,10 +9,11 @@
module API
module Errors
class NotConnected < Exception; end
class ClientError < Exception; end
class ServerError < Exception; end
+ class ConnectionTimeout < Exception; end
end
class Base
include Onering::Util
@@ -58,9 +59,11 @@
}.first
if @_pemfile
@_pem = File.read(File.expand_path(@_pemfile))
@_http = Net::HTTP.new(@_uri.host, (@_uri.port || 443))
+ @_http.open_timeout = 10
+ @_http.read_timeout = 10
@_http.use_ssl = true
@_http.cert = OpenSSL::X509::Certificate.new(@_pem)
@_http.key = OpenSSL::PKey::RSA.new(@_pem)
@_http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end