diff options
-rw-r--r-- | Rakefile | 14 | ||||
-rw-r--r-- | lib/bundler.rb | 4 | ||||
-rw-r--r-- | lib/bundler/vendor/net/http/persistent.rb | 25 |
3 files changed, 31 insertions, 12 deletions
@@ -30,9 +30,17 @@ end namespace :spec do desc "Ensure spec dependencies are installed" task :deps do - deps = RUBY_ENGINE == 'jruby' ? - {"rspec" => "~> 3.0.beta"} : - {"rdiscount" => "~> 1.6", "ronn" => "~> 0.7.3", "rspec" => "~> 3.0.beta"} + deps = { + "rdiscount" => "~> 1.6", + "ronn" => "~> 0.7.3", + "rspec" => "~> 3.0.beta" + } + + # JRuby can't build ronn or rdiscount, so we skip that + if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' + deps.delete("ronn") + deps.delete("rdiscount") + end deps.each do |name, version| sh "#{Gem.ruby} -S gem list -i '^#{name}$' -v '#{version}' || " \ diff --git a/lib/bundler.rb b/lib/bundler.rb index eef79b3ce5..278920549f 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -278,8 +278,8 @@ module Bundler bin_dir = bin_dir.parent until bin_dir.exist? # if any directory is not writable, we need sudo - dirs = [path, bin_dir] | Dir[path.join('*').to_s] - sudo_needed = dirs.find{|d| !File.writable?(d) } + files = [path, bin_dir] | Dir[path.join('build_info/*').to_s] | Dir[path.join('*').to_s] + sudo_needed = files.any?{|f| !File.writable?(f) } end @requires_sudo_ran = true diff --git a/lib/bundler/vendor/net/http/persistent.rb b/lib/bundler/vendor/net/http/persistent.rb index 60a084e14f..4db9305914 100644 --- a/lib/bundler/vendor/net/http/persistent.rb +++ b/lib/bundler/vendor/net/http/persistent.rb @@ -203,7 +203,7 @@ class Net::HTTP::Persistent ## # The version of Net::HTTP::Persistent you are using - VERSION = '2.9' + VERSION = '2.9.3' ## # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with @@ -616,8 +616,6 @@ class Net::HTTP::Persistent if @proxy_uri and not proxy_bypass? uri.host, uri.port then connection_id << @proxy_connection_id net_http_args.concat @proxy_args - elsif proxy_bypass? uri.host, uri.port then - net_http_args.concat [nil, nil] end connection = connections[connection_id] @@ -633,6 +631,7 @@ class Net::HTTP::Persistent start connection unless connection.started? connection.read_timeout = @read_timeout if @read_timeout + connection.keep_alive_timeout = @idle_timeout if @idle_timeout && connection.respond_to?(:keep_alive_timeout=) connection rescue Errno::ECONNREFUSED @@ -669,6 +668,14 @@ class Net::HTTP::Persistent end ## + # URI::unescape wrapper + + def unescape str + CGI.unescape str if str + end + + + ## # Returns true if the connection should be reset due to an idle timeout, or # maximum request count, false otherwise. @@ -860,8 +867,8 @@ class Net::HTTP::Persistent @proxy_args = [ @proxy_uri.host, @proxy_uri.port, - @proxy_uri.user, - @proxy_uri.password, + unescape(@proxy_uri.user), + unescape(@proxy_uri.password), ] @proxy_connection_id = [nil, *@proxy_args].join ':' @@ -957,9 +964,13 @@ class Net::HTTP::Persistent start connection rescue Errno::ECONNREFUSED - raise Error, "connection refused: #{connection.address}:#{connection.port}" + e = Error.new "connection refused: #{connection.address}:#{connection.port}" + e.set_backtrace $@ + raise e rescue Errno::EHOSTDOWN - raise Error, "host down: #{connection.address}:#{connection.port}" + e = Error.new "host down: #{connection.address}:#{connection.port}" + e.set_backtrace $@ + raise e end ## |