xref: /curl/docs/cmdline-opts/fail.md (revision e7219c2b)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: fail
5Short: f
6Protocols: HTTP
7Help: Fail fast with no output on HTTP errors
8Category: important http
9Mutexed: fail-with-body
10Added: 4.0
11Multi: boolean
12See-also:
13  - fail-with-body
14  - fail-early
15Example:
16  - --fail $URL
17---
18
19# `--fail`
20
21Fail fast with no output at all on server errors. This is useful to enable
22scripts and users to better deal with failed attempts. In normal cases when an
23HTTP server fails to deliver a document, it returns an HTML document stating
24so (which often also describes why and more). This command line option
25prevents curl from outputting that and return error 22.
26
27This method is not fail-safe and there are occasions where non-successful
28response codes slip through, especially when authentication is involved
29(response codes 401 and 407).
30