# File lib/bundler/fetcher.rb, line 105
    def specs(gem_names, source)
      old = Bundler.rubygems.sources
      index = Bundler::Index.new

      specs = {}
      fetchers.dup.each do |f|
        break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
        fetchers.delete(f)
      end
      @use_api = false if fetchers.none?(&:api_fetcher?)

      specs[remote_uri].each do |name, version, platform, dependencies|
        next if name == "bundler"
        spec = nil
        if dependencies
          spec = EndpointSpecification.new(name, version, platform, dependencies)
        else
          spec = RemoteSpecification.new(name, version, platform, self)
        end
        spec.source = source
        spec.remote = @remote
        index << spec
      end

      index
    rescue CertificateFailureError
      Bundler.ui.info "" if gem_names && use_api # newline after dots
      raise
    ensure
      Bundler.rubygems.sources = old
    end