]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod-client.c: Fix download size not correctly fallbacks to x-debuginfod-size...
authorlilydjwg <lilydjwg@gmail.com>
Wed, 29 Mar 2023 15:02:36 +0000 (23:02 +0800)
committerFrank Ch. Eigler <fche@redhat.com>
Wed, 29 Mar 2023 19:23:52 +0000 (15:23 -0400)
Signed-off-by: lilydjwg <lilydjwg@gmail.com>
ChangeLog
debuginfod/ChangeLog
debuginfod/debuginfod-client.c

index 10c23002279ecd39aca36926d44b6cba58eacb9d..05697a021f1152bb1ce059cf705d3e682e925952 100644 (file)
--- 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.
index 5db5a753fec381bfbcf9dbf2ad9449a04d76e7c1..a8d264b5b06e0a24fffb93d14a6070331fc6847c 100644 (file)
@@ -1,3 +1,9 @@
+2023-03-29  lilydjwg  <lilydjwg@gmail.com>
+
+       * debuginfod-client.c (debuginfod_query_server): Handle dl_size in
+       progress to account for possible curl 8.0.1 changes to
+       CURLINFO_CONTENT_LENGTH_DOWNLOAD*.
+
 2023-03-17  Aaron Merey  <amerey@redhat.com>
 
        * debuginfod-client.c (debuginfod_query_server): Do not create an
index b33408eb10857c2fc7e1b77f75d7b8ce09550a38..d6d3f0dd0e7f4d9c116fbb7947e5f1ef0dc64270 100644 (file)
@@ -1467,7 +1467,7 @@ debuginfod_query_server (debuginfod_client *c,
           goto out2;
         }
 
-      long dl_size = 0;
+      long dl_size = -1;
       if (target_handle && (c->progressfn || maxsize > 0))
         {
           /* Get size of file being downloaded. NB: If going through
@@ -1486,7 +1486,7 @@ debuginfod_query_server (debuginfod_client *c,
           curl_res = curl_easy_getinfo(target_handle,
                                        CURLINFO_CONTENT_LENGTH_DOWNLOAD,
                                        &cl);
-          if (curl_res == CURLE_OK)
+          if (curl_res == CURLE_OK && cl >= 0)
             dl_size = (cl >= (double)(LONG_MAX+1UL) ? LONG_MAX : (long)cl);
 #endif
           /* If Content-Length is -1, try to get the size from
@@ -1527,7 +1527,7 @@ debuginfod_query_server (debuginfod_client *c,
 
             }
 
-          if ((*c->progressfn) (c, pa, dl_size))
+          if ((*c->progressfn) (c, pa, dl_size == -1 ? 0 : dl_size))
            {
              c->progressfn_cancel = true;
               break;