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.129.124]) by sourceware.org (Postfix) with ESMTPS id 738933858D32 for ; Wed, 1 Nov 2023 23:31:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 738933858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 738933858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698881522; cv=none; b=idUJKlP3SjRxXxK52xE7P97NlcXhr0kDr2ACia2Q6VjdbCIRgYxiOYF2q7GbLWisVMOagh7m7Epe4LqkTo406wm4pSlvWW1NIVM6ZdR0wB7RLrjPh3KU7KEuPP114pqy9JFu58cMkvhU9VwaypA0qXkGWI67pC0hYlPU4ldb8Rw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698881522; c=relaxed/simple; bh=Rw5QD4t7Jcsz484dmXmUFEbI6hjdplF+UI8yJC+Mggc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=N3wYtqZM7qrTch6msjiHan85uDOdJjeuRSZm/WJ+NWxeG7zD7r9LC+c8VUrUjcSnAgjWfPKbuNqx/sPIE5iZPeJzmGagHnW6ykjKlbdH8ZJbAhdFLT3m5wGXbndWEidg7yLU69t/CWAv493GDc8/3G/AeX8MewF5UCcljC1jvzI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698881512; 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: content-transfer-encoding:content-transfer-encoding; bh=ZbbLDFoNq1YgvCPkXNQ/DiX08SP24rcOvuiBvzXVMVM=; b=Jl4I6epdY8Ky3ZExY1cUD9qT5JFvExiWqrxpZ5AU/cp1yjHfZSzjZkd8LELg6HsRP9sjKR +3ZeNMVq0/S1PZA+pi0WKTZgK/8DKuXTxe+xac0sW31G5kw1OUaGQyOO/HAvPzgCBusIZO 3rm0a/4zUhxNr+ixxgQIDnc+0qGkYQQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-Dtez_jg0Pmeif1wz2fYBIQ-1; Wed, 01 Nov 2023 19:31:50 -0400 X-MC-Unique: Dtez_jg0Pmeif1wz2fYBIQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 715E8837222 for ; Wed, 1 Nov 2023 23:31:50 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.32.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id F07FA40C6EBC; Wed, 1 Nov 2023 23:31:49 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [COMMITTED][PATCH] debuginfod-client.c: Don't print empty line in header_callback Date: Wed, 1 Nov 2023 19:31:41 -0400 Message-ID: <20231101233141.271580-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: 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 --- 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