From c1c27625c797cfb7b21128484b4990446c1e92d9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 17 May 2018 13:56:35 +0200 Subject: curl: show headers in bold The feature is only enabled if the output is believed to be a tty. -J: There's some minor differences and improvements in -J handling, as now J should work with -i and it actually creates a file first using the initial name and then *renames* that to the one found in Content-Disposition (if any). -i: only shows headers for HTTP transfers now (as documented). Previously it would also show for pieces of the transfer that were HTTP (for example when doing FTP over a HTTP proxy). -i: now shows trailers as well. Previously they were not shown at all. --libcurl: the CURLOPT_HEADER is no longer set, as the header output is now done in the header callback. --- src/tool_operate.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/tool_operate.c') diff --git a/src/tool_operate.c b/src/tool_operate.c index 626c30888..5be862228 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -851,15 +851,8 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize); my_setopt_str(curl, CURLOPT_URL, this_url); /* what to fetch */ my_setopt(curl, CURLOPT_NOPROGRESS, global->noprogress?1L:0L); - if(config->no_body) { + if(config->no_body) my_setopt(curl, CURLOPT_NOBODY, 1L); - my_setopt(curl, CURLOPT_HEADER, 1L); - } - /* If --metalink is used, we ignore --include (headers in - output) option because mixing headers to the body will - confuse XML parser and/or hash check will fail. */ - else if(!config->use_metalink) - my_setopt(curl, CURLOPT_HEADER, config->include_headers?1L:0L); if(config->oauth_bearer) my_setopt_str(curl, CURLOPT_XOAUTH2_BEARER, config->oauth_bearer); @@ -1373,6 +1366,8 @@ static CURLcode operate_do(struct GlobalConfig *global, hdrcbdata.outs = &outs; hdrcbdata.heads = &heads; + hdrcbdata.global = global; + hdrcbdata.config = config; my_setopt(curl, CURLOPT_HEADERFUNCTION, tool_header_cb); my_setopt(curl, CURLOPT_HEADERDATA, &hdrcbdata); @@ -1523,7 +1518,7 @@ static CURLcode operate_do(struct GlobalConfig *global, /* do not create (or even overwrite) the file in case we get no data because of unmet condition */ curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &cond_unmet); - if(!cond_unmet && !tool_create_output_file(&outs)) + if(!cond_unmet && !tool_create_output_file(&outs, FALSE)) result = CURLE_WRITE_ERROR; } -- cgit v1.2.3