fetch_size (Gem::RemoteFetcher)

    # File lib/rubygems/remote_fetcher.rb, line 57
      def fetch_size(uri)
        return File.size(get_file_uri_path(uri)) if file_uri? uri

        uri = URI.parse uri unless URI::Generic === uri

        raise ArgumentError, 'uri is not an HTTP URI' unless URI::HTTP === uri

        http = connect_to uri.host, uri.port

        request = Net::HTTP::Head.new uri.request_uri

        request.basic_auth unescape(uri.user), unescape(uri.password) unless
          uri.user.nil? or uri.user.empty?

        resp = http.request request

        if resp.code !~ /^2/ then
          raise Gem::RemoteSourceException,
                "HTTP Response #{resp.code} fetching #{uri}"
        end

        if resp['content-length'] then
          return resp['content-length'].to_i
        else
          resp = http.get uri.request_uri
          return resp.body.size
        end

      rescue SocketError, SystemCallError, Timeout::Error => e
        raise FetchError, "#{e.message} (#{e.class})\n\tgetting size of #{uri}"
      end