From 82c53f821fa3fd40379b4c801cc77eb27b4f871e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 10 Jul 2024 16:30:17 +0200 Subject: [PATCH] tool_getparam: make --show-headers the same as --include Simply a name alias that better explains what the option does. Closes #13987 --- docs/cmdline-opts/Makefile.inc | 2 +- docs/cmdline-opts/include.md | 23 ----------------------- docs/cmdline-opts/show-headers.md | 29 +++++++++++++++++++++++++++++ docs/options-in-versions | 2 +- src/tool_getparam.c | 5 ++++- src/tool_listhelp.c | 6 +++--- tests/data/test1461 | 2 +- tests/test1139.pl | 1 + 8 files changed, 40 insertions(+), 30 deletions(-) delete mode 100644 docs/cmdline-opts/include.md create mode 100644 docs/cmdline-opts/show-headers.md diff --git a/docs/cmdline-opts/Makefile.inc b/docs/cmdline-opts/Makefile.inc index 75178b28a..963da4eae 100644 --- a/docs/cmdline-opts/Makefile.inc +++ b/docs/cmdline-opts/Makefile.inc @@ -134,7 +134,6 @@ DPAGES = \ http3.md \ http3-only.md \ ignore-content-length.md \ - include.md \ insecure.md \ interface.md \ ip-tos.md \ @@ -252,6 +251,7 @@ DPAGES = \ sasl-ir.md \ service-name.md \ show-error.md \ + show-headers.md \ silent.md \ socks4.md \ socks4a.md \ diff --git a/docs/cmdline-opts/include.md b/docs/cmdline-opts/include.md deleted file mode 100644 index e48799128..000000000 --- a/docs/cmdline-opts/include.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -c: Copyright (C) Daniel Stenberg, , et al. -SPDX-License-Identifier: curl -Long: include -Short: i -Help: Include response headers in output -Protocols: HTTP FTP -Category: important verbose -Added: 4.8 -Multi: boolean -See-also: - - verbose -Example: - - -i $URL ---- - -# `--include` - -Include response headers in the output. HTTP response headers can include -things like server name, cookies, date of the document, HTTP version and -more... With non-HTTP protocols, the "headers" are other server communication. - -To view the request headers, consider the --verbose option. diff --git a/docs/cmdline-opts/show-headers.md b/docs/cmdline-opts/show-headers.md new file mode 100644 index 000000000..126610f7c --- /dev/null +++ b/docs/cmdline-opts/show-headers.md @@ -0,0 +1,29 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Long: show-headers +Short: i +Help: Show response headers in output +Protocols: HTTP FTP +Category: important verbose output +Added: 4.8 +Multi: boolean +See-also: + - verbose +Example: + - -i $URL +--- + +# `--show-headers` + +Show response headers in the output. HTTP response headers can include things +like server name, cookies, date of the document, HTTP version and more. With +non-HTTP protocols, the "headers" are other server communication. + +To view the request headers, consider the --verbose option. + +Prior to 7.75.0 curl did not print the headers if --fail was used in +combination with this option and there was error reported by server. + +This option was called --include before 8.10.0. The previous name remains +functional. diff --git a/docs/options-in-versions b/docs/options-in-versions index e19965e6a..e53935ccb 100644 --- a/docs/options-in-versions +++ b/docs/options-in-versions @@ -101,7 +101,6 @@ --ignore-content-length 7.14.1 --ip-tos 8.9.0 --ipfs-gateway 8.4.0 ---include (-i) 4.8 --insecure (-k) 7.10 --interface 7.3 --ipv4 (-4) 7.10.8 @@ -217,6 +216,7 @@ --sasl-ir 7.31.0 --service-name 7.43.0 --show-error (-S) 5.9 +--show-headers (-i) 4.8 --silent (-s) 4.0 --socks4 7.15.2 --socks4a 7.18.0 diff --git a/src/tool_getparam.c b/src/tool_getparam.c index ae5dec9a1..eaa00e206 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -286,6 +286,7 @@ typedef enum { C_SERVICE_NAME, C_SESSIONID, C_SHOW_ERROR, + C_SHOW_HEADERS, C_SILENT, C_SOCKS4, C_SOCKS4A, @@ -458,7 +459,7 @@ static const struct LongShort aliases[]= { {"http3", ARG_NONE, ' ', C_HTTP3}, {"http3-only", ARG_NONE, ' ', C_HTTP3_ONLY}, {"ignore-content-length", ARG_BOOL, ' ', C_IGNORE_CONTENT_LENGTH}, - {"include", ARG_BOOL, 'i', C_INCLUDE}, + {"include", ARG_BOOL, ' ', C_INCLUDE}, {"insecure", ARG_BOOL, 'k', C_INSECURE}, {"interface", ARG_STRG, ' ', C_INTERFACE}, {"ip-tos", ARG_STRG, ' ', C_IP_TOS}, @@ -574,6 +575,7 @@ static const struct LongShort aliases[]= { {"service-name", ARG_STRG, ' ', C_SERVICE_NAME}, {"sessionid", ARG_BOOL, ' ', C_SESSIONID}, {"show-error", ARG_BOOL, 'S', C_SHOW_ERROR}, + {"show-headers", ARG_BOOL, 'i', C_SHOW_HEADERS}, {"silent", ARG_BOOL, 's', C_SILENT}, {"socks4", ARG_STRG, ' ', C_SOCKS4}, {"socks4a", ARG_STRG, ' ', C_SOCKS4A}, @@ -2492,6 +2494,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ } break; case C_INCLUDE: /* --include */ + case C_SHOW_HEADERS: /* --show-headers */ config->show_headers = toggle; /* show the headers as well in the general output stream */ break; diff --git a/src/tool_listhelp.c b/src/tool_listhelp.c index 4095d4aa3..d87beae6d 100644 --- a/src/tool_listhelp.c +++ b/src/tool_listhelp.c @@ -302,9 +302,6 @@ const struct helptxt helptext[] = { {" --ignore-content-length", "Ignore the size of the remote resource", CURLHELP_HTTP | CURLHELP_FTP}, - {"-i, --include", - "Include response headers in output", - CURLHELP_IMPORTANT | CURLHELP_VERBOSE}, {"-k, --insecure", "Allow insecure server connections", CURLHELP_TLS | CURLHELP_SFTP | CURLHELP_SCP | CURLHELP_SSH}, @@ -659,6 +656,9 @@ const struct helptxt helptext[] = { {"-S, --show-error", "Show error even when -s is used", CURLHELP_CURL | CURLHELP_GLOBAL}, + {"-i, --show-headers", + "Show response headers in output", + CURLHELP_IMPORTANT | CURLHELP_VERBOSE | CURLHELP_OUTPUT}, {"-s, --silent", "Silent mode", CURLHELP_IMPORTANT | CURLHELP_VERBOSE}, diff --git a/tests/data/test1461 b/tests/data/test1461 index 669e5fbf4..b1544ff5b 100644 --- a/tests/data/test1461 +++ b/tests/data/test1461 @@ -35,9 +35,9 @@ Usage: curl [options...] -d, --data HTTP POST data -f, --fail Fail fast with no output on HTTP errors -h, --help Get help for commands - -i, --include Include response headers in output -o, --output Write to file instead of stdout -O, --remote-name Write output to file named as remote file + -i, --show-headers Show response headers in output -s, --silent Silent mode -T, --upload-file Transfer local FILE to destination -u, --user Server user and password diff --git a/tests/test1139.pl b/tests/test1139.pl index 421af70b8..6ecab78ec 100755 --- a/tests/test1139.pl +++ b/tests/test1139.pl @@ -177,6 +177,7 @@ my %opts = ( '--krb4' => 6, '--ftp-ssl' => 6, '--ftp-ssl-reqd' => 6, + '--include' => 6, # for tests and debug only, can remain hidden '--test-event' => 6,