diff --git a/.travis.yml b/.travis.yml index 41edfb2..e69e2f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: ruby script: bundle exec rspec spec rvm: - - 2.0.0 + - 2.3.0 sudo: false diff --git a/lib/pincers/http/client.rb b/lib/pincers/http/client.rb index e858ce7..a1ba284 100644 --- a/lib/pincers/http/client.rb +++ b/lib/pincers/http/client.rb @@ -16,6 +16,7 @@ def self.build_from_options(_options = {}) session.proxy_auth = _options[:proxy_auth] if _options.key? :proxy_auth session.headers.merge! _options[:headers] if _options.key? :headers session.redirect_limit = _options[:redirect_limit] if _options.key? :redirect_limit + session.read_timeout = _options[:read_timeout] if _options.key? :read_timeout if _options.key? :ssl_cert session.ssl_cert = _options[:ssl_cert] diff --git a/lib/pincers/http/session.rb b/lib/pincers/http/session.rb index e0bb362..5757c93 100644 --- a/lib/pincers/http/session.rb +++ b/lib/pincers/http/session.rb @@ -12,7 +12,7 @@ class Session attr_reader :cookie_jar, :headers attr_accessor :proxy_addr, :proxy_port, :proxy_user, :proxy_password, :redirect_limit, - :ssl_cert, :ssl_key + :ssl_cert, :ssl_key, :read_timeout def initialize(_other = nil) if _other @@ -23,6 +23,7 @@ def initialize(_other = nil) @redirect_limit = _other.redirect_limit @ssl_cert = _other.ssl_cert @ssl_key = _other.ssl_key + @read_timeout = _other.read_timeout || 60 else @headers = DEFAULT_HEADERS @cookie_jar = CookieJar.new @@ -104,6 +105,8 @@ def connect(_uri) proxy_password ) + conn.read_timeout = read_timeout + conn.use_ssl = true if _uri.scheme == 'https' if ssl_cert