diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-02-11 08:30:39 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-02-11 08:35:27 +0100 |
commit | 8a964cb217b0cd84783da5ba32b18944fc43feb1 (patch) | |
tree | d6201c16d66c0b3fd1d7496ecc9d046479792f5e /src/tool_getparam.c | |
parent | c386a0df441538ee4fbcf6e4bdac77abe5cc3e5d (diff) | |
download | curl-8a964cb217b0cd84783da5ba32b18944fc43feb1.tar.gz |
curl: add --fail-with-body
Prevent both --fail and --fail-with-body on the same command line.
Verify with test 349, 360 and 361.
Closes #6449
Diffstat (limited to 'src/tool_getparam.c')
-rw-r--r-- | src/tool_getparam.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 812ce7fd9..d187643a7 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -280,6 +280,7 @@ static const struct LongShort aliases[]= { {"fa", "fail-early", ARG_BOOL}, {"fb", "styled-output", ARG_BOOL}, {"fc", "mail-rcpt-allowfails", ARG_BOOL}, + {"fd", "fail-with-body", ARG_BOOL}, {"F", "form", ARG_STRING}, {"Fs", "form-string", ARG_STRING}, {"g", "globoff", ARG_BOOL}, @@ -1766,8 +1767,17 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ case 'c': /* --mail-rcpt-allowfails */ config->mail_rcpt_allowfails = toggle; break; + case 'd': /* --fail-with-body */ + config->failwithbody = toggle; + break; default: /* --fail (hard on errors) */ config->failonerror = toggle; + break; + } + if(config->failonerror && config->failwithbody) { + errorf(config->global, "You must select either --fail or " + "--fail-with-body, not both.\n"); + return PARAM_BAD_USE; } break; case 'F': |