From ec9165fdffe63f6d5a8b2a9a302252ec1116618c Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Fri, 10 Jan 2014 18:18:55 -0800 Subject: Merge tag 'v1.5.2' into 'master' Conflicts: CHANGELOG.md Rakefile lib/bundler/installer.rb lib/bundler/rubygems_ext.rb lib/bundler/source/rubygems.rb spec/realworld/parallel_install_spec.rb spec/realworld/parallel_update_spec.rb --- lib/bundler/fetcher.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib/bundler/fetcher.rb') diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 548002fb9b..940eb4fd24 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -226,7 +226,7 @@ module Bundler private HTTP_ERRORS = [ - Timeout::Error, EOFError, SocketError, + Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Net::HTTP::Persistent::Error @@ -235,17 +235,7 @@ module Bundler def fetch(uri, counter = 0) raise HTTPError, "Too many redirects" if counter >= @redirect_limit - begin - Bundler.ui.debug "Fetching from: #{uri}" - req = Net::HTTP::Get.new uri.request_uri - req.basic_auth(uri.user, uri.password) if uri.user - response = connection.request(uri, req) - rescue OpenSSL::SSL::SSLError - raise CertificateFailureError.new(uri) - rescue *HTTP_ERRORS - raise HTTPError, "Network error while fetching #{uri}" - end - + response = request(uri) case response when Net::HTTPRedirection Bundler.ui.debug("HTTP Redirection") @@ -265,6 +255,17 @@ module Bundler end end + def request(uri) + Bundler.ui.debug "Fetching from: #{uri}" + req = Net::HTTP::Get.new uri.request_uri + req.basic_auth(uri.user, uri.password) if uri.user + response = connection.request(uri, req) + rescue OpenSSL::SSL::SSLError + raise CertificateFailureError.new(uri) + rescue *HTTP_ERRORS + raise HTTPError, "Network error while fetching #{uri}" + end + def dependency_api_uri(gem_names = []) url = "#{@remote_uri}api/v1/dependencies" url << "?gems=#{URI.encode(gem_names.join(","))}" if gem_names.any? -- cgit v1.2.1