diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-05-17 13:56:35 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-05-21 20:05:05 +0200 |
commit | c1c27625c797cfb7b21128484b4990446c1e92d9 (patch) | |
tree | 7a1e6b2597a10628f7787e16bb850adb09a87fc7 /src/tool_operate.c | |
parent | 6876ccf90b473480998af4619de5f316fbd63084 (diff) | |
download | curl-c1c27625c797cfb7b21128484b4990446c1e92d9.tar.gz |
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.
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r-- | src/tool_operate.c | 15 |
1 files changed, 5 insertions, 10 deletions
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, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, 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; } |