From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E2EFD3858CDA for ; Thu, 30 Mar 2023 17:24:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2EFD3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680197056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=z7qlx0zx8bjf1j57EQyvsXnc/hCvw4HQ5LrAOChVx70=; b=Y8OEVBwcW2bPVfWdSKBy9CUxcxNHcrk7sF7dNy4qcoq1bbYq7toJUtK+Jg0MOuGxx53oXu SNiEOXjmFK6+h5YJay10ynYb51F0SUf+8S9lIzi27shIrlKnucdtcsi04w1GNRLJb6QbXY TdqOLOLNmAO/T9GCP8fjSEQjT0/Okqs= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-2zwvSmK0Ooe9joL-pIGI8w-1; Thu, 30 Mar 2023 13:24:15 -0400 X-MC-Unique: 2zwvSmK0Ooe9joL-pIGI8w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A681A1C05131; Thu, 30 Mar 2023 17:24:14 +0000 (UTC) Received: from redhat.com (unknown [10.2.16.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97A54492B00; Thu, 30 Mar 2023 17:24:14 +0000 (UTC) Received: from fche by redhat.com with local (Exim 4.94.2) (envelope-from ) id 1phw0T-0004nb-QW; Thu, 30 Mar 2023 13:24:13 -0400 Date: Thu, 30 Mar 2023 13:24:13 -0400 From: "Frank Ch. Eigler" To: lilydjwg Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH v2 2/2] debuginfod-client.c: Fix x-debuginfod-size counts differently than CURLINFO_SIZE_DOWNLOAD_T Message-ID: <20230330172413.GG30778@redhat.com> References: <20230329150237.896092-1-lilydjwg@gmail.com> <20230329150237.896092-2-lilydjwg@gmail.com> <20230329191443.GB30778@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi - > > Hey, great idea actually tallying up writes in the callback function. > > (We need to take care to clear that counter, in case of client object > > reuse.) Also, can you think of some reason not to just use that value > > at all times, i.e., without any of that "if and only if ..." business? > > The counter is in handle_data, and it is already cleared at > "query_in_parallel:". I don't find other places that may reuse them. OK. > The written_size is actual file size (uncompressed), but IIUC > Content-Length is the compressed size if Content-Encoding says the > content is compressed. I haven't seen any compressed responses with > Content-Length, but from the spec I don't read they are not allowed. OK, so to spell out the hypothetical problem: what if a httpd server does send back a Content-Length: response header for a compressed file, and we use that as the denominator for progress reporting. If we use the decompressed actual file length as numerator, we'd go over 100%. Then ISTM a simpler way to handle this would be to say that if the x-debuginfod-size: response header is found (as denominator), then go ahead and use the actual data[committed_to].written_size (as numerator). Don't even try the CURLINFO_SIZE* queries then. - FChE