Skip to content

Commit 5e2e470

Browse files
committed
cmdline-opts/fail.md: expand and clarify
Closes #13890
1 parent 881e9a6 commit 5e2e470

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

docs/cmdline-opts/fail.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ Example:
1818

1919
# `--fail`
2020

21-
Fail fast with no output at all on server errors. This is useful to enable
22-
scripts and users to better deal with failed attempts. In normal cases when an
23-
HTTP server fails to deliver a document, it returns an HTML document stating
24-
so (which often also describes why and more). This command line option
25-
prevents curl from outputting that and return error 22.
21+
Fail with error code 22 and with no response body output at all for HTTP
22+
transfers returning HTTP response codes at 400 or greater.
23+
24+
In normal cases when an HTTP server fails to deliver a document, it returns a
25+
body of text stating so (which often also describes why and more) and a 4xx
26+
HTTP response code. This command line option prevents curl from outputting
27+
that data and instead returns error 22 early. By default, curl does not
28+
consider HTTP response codes to indicate failure.
29+
30+
To get both the error code and also save the content, use --fail-with-body
31+
instead.
2632

2733
This method is not fail-safe and there are occasions where non-successful
2834
response codes slip through, especially when authentication is involved

0 commit comments

Comments
 (0)