From b963018eec171be99a2658b6ea38ba9f6cb5cb55 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 9 Feb 2016 17:29:41 +0100 Subject: Actually use the read_timeout config option --- lib/gitlab_net.rb | 6 +++++- spec/gitlab_net_spec.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index 4377005..71e113b 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -73,7 +73,7 @@ class GitlabNet http = Net::HTTP.new(uri.host, uri.port) end - http.read_timeout = options[:read_timeout] || READ_TIMEOUT + http.read_timeout = options[:read_timeout] || read_timeout if uri.is_a?(URI::HTTPS) http.use_ssl = true @@ -154,4 +154,8 @@ class GitlabNet def secret_token @secret_token ||= File.read config.secret_file end + + def read_timeout + config.http_settings['read_timeout'] || READ_TIMEOUT + end end diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb index 3c2cea2..2d9b544 100644 --- a/spec/gitlab_net_spec.rb +++ b/spec/gitlab_net_spec.rb @@ -143,7 +143,7 @@ describe GitlabNet, vcr: true do subject { gitlab_net.send :http_client_for, URI('https://localhost/') } before do gitlab_net.stub! :cert_store - gitlab_net.send(:config).http_settings.stub(:[]).with('self_signed_cert') { true } + gitlab_net.send(:config).stub(:http_settings) { {'self_signed_cert' => true} } end its(:verify_mode) { should eq(OpenSSL::SSL::VERIFY_NONE) } -- cgit v1.2.1