diff options
author | Andre Arko <andre@arko.net> | 2014-01-10 18:18:55 -0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-01-10 23:05:03 -0800 |
commit | ec9165fdffe63f6d5a8b2a9a302252ec1116618c (patch) | |
tree | 832691ee4d654f00b183893de5b9d6af8435d00e /lib/bundler/fetcher.rb | |
parent | 27205e903455e38a79a765c0426f63e3ae8efd0e (diff) | |
download | bundler-ec9165fdffe63f6d5a8b2a9a302252ec1116618c.tar.gz |
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
Diffstat (limited to 'lib/bundler/fetcher.rb')
-rw-r--r-- | lib/bundler/fetcher.rb | 25 |
1 files changed, 13 insertions, 12 deletions
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? |