public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] debuginfod-client.c: Fix download size not correctly fallbacks to x-debuginfod-size header
@ 2023-03-29  4:51 lilydjwg
  2023-03-29 12:28 ` Frank Ch. Eigler
  0 siblings, 1 reply; 14+ messages in thread
From: lilydjwg @ 2023-03-29  4:51 UTC (permalink / raw)
  To: elfutils-devel; +Cc: lilydjwg

From: lilydjwg <lilydjwg@gmail.com>

Currently when the debuginfod server doesn't set Content-Length but set
x-debuginfod-size header, it's ignored and the progressfn doesn't know
the total size.

This happens for me with Arch Linux's debuginfod server and gdb.

The reason is that when Content-Length is unavailable, cl is set to -1
by curl but dl_size remains as 0, but later dl_size == -1 is checked.

Signed-off-by: lilydjwg <lilydjwg@gmail.com>
---
 ChangeLog                      | 5 +++++
 debuginfod/debuginfod-client.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 10c23002..05697a02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-29  lilydjwg  <lilydjwg@gmail.com>
+
+	* debuginfod/debuginfod-client.c: Fix download size not correctly
+	fallbacks to x-debuginfod-size header
+
 2023-03-03  Mark Wielaard  <mark@klomp.org>
 
 	* NEWS: Add ELFCOMPRESS_ZSTD support for libelf and elfcompress.
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index b33408eb..e494adec 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1479,7 +1479,7 @@ debuginfod_query_server (debuginfod_client *c,
           curl_res = curl_easy_getinfo(target_handle,
                                        CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
                                        &cl);
-          if (curl_res == CURLE_OK && cl >= 0)
+          if (curl_res == CURLE_OK)
             dl_size = (cl > LONG_MAX ? LONG_MAX : (long)cl);
 #else
           double cl;
-- 
2.40.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-08-29 19:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29  4:51 [PATCH] debuginfod-client.c: Fix download size not correctly fallbacks to x-debuginfod-size header lilydjwg
2023-03-29 12:28 ` Frank Ch. Eigler
2023-03-29 14:57   ` lilydjwg
2023-03-29 15:02     ` [PATCH v2 1/2] " lilydjwg
2023-03-29 15:02       ` [PATCH v2 2/2] debuginfod-client.c: Fix x-debuginfod-size counts differently than CURLINFO_SIZE_DOWNLOAD_T lilydjwg
2023-03-29 19:14         ` Frank Ch. Eigler
2023-03-30  3:41           ` lilydjwg
2023-03-30 17:24             ` Frank Ch. Eigler
2023-03-31  4:50               ` lilydjwg
2023-08-29 13:17                 ` Mark Wielaard
2023-08-29 18:33                   ` PR30809, was " Frank Ch. Eigler
2023-08-29 19:26                     ` Mark Wielaard
2023-03-29 20:49       ` [PATCH v2 1/2] debuginfod-client.c: Fix download size not correctly fallbacks to x-debuginfod-size header Frank Ch. Eigler
2023-03-29 15:05     ` [PATCH] " lilydjwg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).