public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: elfutils-devel@sourceware.org
Cc: Aaron Merey <amerey@redhat.com>
Subject: [COMMITTED][PATCH] debuginfod-client.c: Don't print empty line in header_callback
Date: Wed,  1 Nov 2023 19:31:41 -0400	[thread overview]
Message-ID: <20231101233141.271580-1-amerey@redhat.com> (raw)

libcurl passes an empty line to header_callback indicating the end
of the response's HTTP headers.

Currently this empty line is printed to the debuginfod_client's
verbose_fd with a "header" prefix:

    $ echo $DEBUGINFOD_URLS
    https://debuginfod.fedoraproject.org/
    $ debuginfod-find -vv debuginfo e2bbf033b548021c37866429f12a99bd33bd6e8d
    [...]
    header x-fedora-requestid: ZULLx0PPA8nmj8c8Hw-RtAACgAE
    header server: Apache
    header
    [...]

Prevent this unnecessary line of output by only printing non-empty
lines in header_callback.

Signed-off-by: Aaron Merey <amerey@redhat.com>
---
 debuginfod/debuginfod-client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 6882cb19..dcf05031 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -568,7 +568,9 @@ header_callback (char * buffer, size_t size, size_t numitems, void * userdata)
   struct handle_data *data = (struct handle_data *) userdata;
   if (size != 1)
     return 0;
-  if (data->client && data->client->verbose_fd >= 0)
+  if (data->client
+      && data->client->verbose_fd >= 0
+      && numitems > 2)
     dprintf (data->client->verbose_fd, "header %.*s", (int)numitems, buffer);
   // Some basic checks to ensure the headers received are of the expected format
   if (strncasecmp(buffer, "X-DEBUGINFOD", 11)
-- 
2.41.0


                 reply	other threads:[~2023-11-01 23:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231101233141.271580-1-amerey@redhat.com \
    --to=amerey@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).