From patchwork Mon Nov 20 11:10:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 839515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23e; helo=mail-wm0-x23e.google.com; envelope-from=swupdate+bncbcxploxj6ikrbmpqzliakgqe4i7bppq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="aPG7CkYC"; dkim-atps=neutral Received: from mail-wm0-x23e.google.com (mail-wm0-x23e.google.com [IPv6:2a00:1450:400c:c09::23e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ygQxb26FZz9s4s for ; Mon, 20 Nov 2017 22:10:43 +1100 (AEDT) Received: by mail-wm0-x23e.google.com with SMTP id i17sf6192115wmb.7 for ; Mon, 20 Nov 2017 03:10:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1511176241; cv=pass; d=google.com; s=arc-20160816; b=kcTrbDrhQy79Om3GnRESSCfGLMviIw7KfPg+T/G0sRxiKFeou8v06gC8FYFn7lopp9 wFmBMYrvSw+iD297urMqAE07p8uqRL/mJkhc/21kL61mi7jLT/5D0T/IVWVyaqUYEbOG sVLXV4ALhn+emNMCdWBJpedoW708lGDit3WDB51F+EaCXn2Y2ykG4Xx0+7wFDG51kzzq kOv6TedblTR8gYaGBPoN3Zq+dA7DAunBr7QTR9vHO5odmHQO1syfi4HHctP2Mxcq4Ix2 bEIdMRvwkWIadgxV4DcxMQX4TN1+oT+UigpBT9iL0vhpWxSLsfG11fOZomCnqDCE1UPm IQrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=4G1VEkSRa5z6rO0nvtQZQkNzTzo4igyScZ/Kqz5bCOo=; b=A8XD91eYNXBydeYAQCzCcSyY7yTwJZk2Z6ZgLfeMNCi5NnkJ2QQqAkA8pBw6ds7WkJ 1MxB/Q16bBghM0JUz9CdwNwwNoNzlOorz/3HTW4SnMkq/kU2G0USd1I4VkBqZHTsH78R eZ5/ox6Fp2/yQDYiEzciEUyJBN/aJX2fz8hAtNJWzDBVk121JsgUK8mNpEuUw/eSmiCY CqZZjzMoL1YIdZiNZGjxlGnK9UOWk8xaLws9+ZTsqb9NtvXiYAhCGEiFM/9hN4rTUXrb eiflQzbauI3UJDhXt7LNhOg/8EjmkBRIhLJV5N3e1rMvgkJmCDynzsjzvlGVowmb5/Oc Fjlw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=4G1VEkSRa5z6rO0nvtQZQkNzTzo4igyScZ/Kqz5bCOo=; b=aPG7CkYCYaWA5GbNXqS+UVbvlRmnZOt8RoJBvlTfr3eEJD9g1DGSkvLQAlW7hh7qmu xYdIaRIMBQ4TkFo0aJZlFs/qrhyCWWACX5Y8XIy1mEu7jkiwom7ZVe9S1eLh3ujr1dZ6 Av1oBqka7Ju75ThPjL9k+MOjymTYRXDecrd7j1nOL5yYYieqqqLeK9BvPQg8OP/b292n 3TQRIOL2faCZS9Pv2QkNfQ/xYIVA2zL6ZoWlYj5QFtyXITADW+/jsW9mSu4NXMJzYrGu jNv9e+DSRqOkXN3g8NTuU1lYFSBYy5/lXp3wpq6/A+u4j9LVq0yoakGuFvFlDsp2XA2S r2vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=4G1VEkSRa5z6rO0nvtQZQkNzTzo4igyScZ/Kqz5bCOo=; b=Zs3BxnMvYClUb9bxLs6K/yynDESXExEysPZwoXg22d0tAhHYQBdn9HDw8clRdrngRQ TYW/rMyLTvJ0hONWmzubO6s+XvLIdruelve+AWTINM5a0blJO0TjZSLbjj39XlJH/DIr NvOr0bZqagZpJmVVkFxplBK3/nwSCWF3NMIXuKtEnXBZuMa15dQoVEFZmMglhG0MIHDO HAVj0/oNf5GxV1h/thMnJlQppvwMkXGaX1a7gat31DC2TlALQq0hxH4hPoQOXm+zo+bB iAYShr6lXquQnvenJc5D0FRRVKNBHTExLpN4lKSOQ47ihl3dd3AeawIqcExo67/e2o6z XANA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AJaThX4rpQtE1nTx0cSzFnHCpTg95zkQfMfffEnsjZhdHBbAW01Gmc9Q mxFnH9mo7LC6uLuYAdl5VTY= X-Google-Smtp-Source: AGs4zMbfu8+eMQOkQB7MIFTC5PWL1xfFLsqIEgCCgJ8IkeOdWXfVD0LQu0/gEuDHj9bSlG/lxPT58Q== X-Received: by 10.28.113.149 with SMTP id d21mr143342wmi.5.1511176241110; Mon, 20 Nov 2017 03:10:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.130.71 with SMTP id e68ls898400wmd.9.gmail; Mon, 20 Nov 2017 03:10:40 -0800 (PST) X-Received: by 10.28.31.82 with SMTP id f79mr1299776wmf.26.1511176240954; Mon, 20 Nov 2017 03:10:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511176240; cv=none; d=google.com; s=arc-20160816; b=ojWzzh9eraDFIaqvSAlEdCrisat4N41Cbw+wJEHM1v8jf+S5TN+pXFWfoSRMGZvK9c WTmPQQTjO6mmypKeFh266A4/kFpfspqZBFganvjmD9jszD/L+OF3515r9KVM80JChTzI UzSv1NqM847TK8hJbHM0fbkPCU87EgXWT7VX0/KVjP4+nywvG+NOPd4WNVMkWaIgYv1Q lfQv7TaP6hinUSB9z7ddD1yZDIORgg8nnZbEKZHrQdEQjQLShq8czFXDY5HRSPzG8aos LIAXjbJMB2Gv0bRLxLK75nFkAkrPiDYXXsO48Sl3rHXxERDVe02R2bXoDJ/A5avA9FTo 61pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ukZSMXoCf1flPzvYDnHjyWUNLLS1LcYXxCrEqSJVTmU=; b=kaIFkY5+uHNWK2ZCDlZ3qQEL1u1+GHciJVuLhh1NH7Q2vq2LP3ONVQNPTJP9JPXEix H7+MGg/Tqu3mO6J4xV+wHaAJJ9dIkiZztiDnNhwIsJ302jB7ljYeRL/XSO5jaw+mx2T/ jX6hFjwDwc45zzTJcn4TzLYWLiFICtwU93DKsUYHczac+qulxScIXs71Ptb0wovDZH// +GHWpdYSRdpqV2AYtcCfP0R4oR4xkZoDrRVjZXZnnMhrv0H6PfHHgS+xvlIT1lYTxsrR 1O+WNxgr8xVdyErxt5QIp0duZpMdNqOVMyQNGz4Sd0hKq1rNUPbQ02AFCW0oPNgLMrAU eYLw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id j13si442577wmh.1.2017.11.20.03.10.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 03:10:40 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3ygQxX5STXz1qsDt; Mon, 20 Nov 2017 12:10:40 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3ygQxX5M3dz1qqkc; Mon, 20 Nov 2017 12:10:40 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 8Y5v9nG8ihh4; Mon, 20 Nov 2017 12:10:39 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Mon, 20 Nov 2017 12:10:39 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id E8139454057C; Mon, 20 Nov 2017 12:10:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wk6_D5X8d4Cc; Mon, 20 Nov 2017 12:10:36 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 175B0454064D; Mon, 20 Nov 2017 12:10:20 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 11/17] Debug output in curl just if debug is set Date: Mon, 20 Nov 2017 12:10:04 +0100 Message-Id: <1511176210-28928-11-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511176210-28928-1-git-send-email-sbabic@denx.de> References: <1511176210-28928-1-git-send-email-sbabic@denx.de> X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , A debug flag is allowed for each connection made via libcurl. Check if the debug flag is set before calling DEBUG(/). Signed-off-by: Stefano Babic --- corelib/channel_curl.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index 257efbe..705b887 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -538,8 +538,10 @@ static channel_op_res_t channel_post_method(channel_t *this, void *data) http_response_code); goto cleanup_header; } - TRACE("Channel put operation returned HTTP status code %ld.\n", - http_response_code); + if (channel_data->debug) { + TRACE("Channel put operation returned HTTP status code %ld.\n", + http_response_code); + } cleanup_header: curl_easy_reset(channel_curl->handle); @@ -790,8 +792,10 @@ channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle) http_response_code); goto cleanup_file; } - TRACE("Channel operation returned HTTP status code %ld.\n", - http_response_code); + if (channel_data->debug) { + TRACE("Channel operation returned HTTP status code %ld.\n", + http_response_code); + } if (result_channel_callback_write_file != CHANNEL_OK) { result = CHANNEL_EIO; @@ -822,6 +826,10 @@ cleanup_file: ERROR("Channel error while closing download target handle: '%s'\n", strerror(errno)); } + if (channel_data->dgst) { + swupdate_HASH_cleanup(channel_data->dgst); + } + cleanup_header: curl_easy_reset(channel_curl->handle); curl_slist_free_all(channel_curl->header); @@ -881,7 +889,9 @@ channel_op_res_t channel_get(channel_t *this, void *data) goto cleanup_chunk; } - DEBUG("Trying to GET %s", channel_data->url); + if (channel_data->debug) { + DEBUG("Trying to GET %s", channel_data->url); + } CURLcode curlrc = curl_easy_perform(channel_curl->handle); if (curlrc != CURLE_OK) { ERROR("Channel get operation failed (%d): '%s'\n", curlrc, @@ -890,7 +900,9 @@ channel_op_res_t channel_get(channel_t *this, void *data) goto cleanup_chunk; } - channel_log_effective_url(this); + if (channel_data->debug) { + channel_log_effective_url(this); + } long http_response_code; if ((result = channel_map_http_code(this, &http_response_code)) != @@ -905,8 +917,10 @@ channel_op_res_t channel_get(channel_t *this, void *data) } goto cleanup_chunk; } - TRACE("Channel operation returned HTTP status code %ld.\n", - http_response_code); + if (channel_data->debug) { + TRACE("Channel operation returned HTTP status code %ld.\n", + http_response_code); + } assert(channel_data->json_reply == NULL); enum json_tokener_error json_res;