# File lib/bundler/fetcher.rb, line 100
    def specs(gem_names, source)
      index = Index.new
      use_full_source_index = !gem_names || @remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint

      if gem_names && use_api
        Bundler.ui.info "Fetching gem metadata from #{@public_uri}", Bundler.ui.debug?
        specs = fetch_remote_specs(gem_names)
        # new line now that the dots are over
        Bundler.ui.info "" if specs && !Bundler.ui.debug?
      end

      if specs.nil?
        # API errors mean we should treat this as a non-API source
        @use_api = false

        Bundler.ui.info "Fetching source index from #{@public_uri}"
        specs = fetch_all_remote_specs
      end

      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_fetch_map[spec.full_name] = [spec, @remote_uri]
        index << spec
      end

      index
    rescue CertificateFailureError => e
      Bundler.ui.info "" if gem_names && use_api # newline after dots
      raise e
    end