From 8da8547c9869ab429f986517c41984dda0c050f5 Mon Sep 17 00:00:00 2001 From: mariowise Date: Tue, 6 Dec 2016 09:57:14 -0300 Subject: [PATCH 1/2] feat(http): read_timout option before request --- lib/pincers/http/client.rb | 1 + lib/pincers/http/session.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 From bc67899522941b9a73229e939ebfbd72e807e561 Mon Sep 17 00:00:00 2001 From: mariowise Date: Tue, 6 Dec 2016 10:37:58 -0300 Subject: [PATCH 2/2] chore(): moved to ruby 2.2.5 --- .ruby-version | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index 227cea2..21bb5e1 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0 +2.2.5 diff --git a/.travis.yml b/.travis.yml index 41edfb2..8068834 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: ruby script: bundle exec rspec spec rvm: - - 2.0.0 + - 2.2.5 sudo: false