1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerLong: fail 5*6236dae4SAndroid Build Coastguard WorkerShort: f 6*6236dae4SAndroid Build Coastguard WorkerProtocols: HTTP 7*6236dae4SAndroid Build Coastguard WorkerHelp: Fail fast with no output on HTTP errors 8*6236dae4SAndroid Build Coastguard WorkerCategory: important http 9*6236dae4SAndroid Build Coastguard WorkerMutexed: fail-with-body 10*6236dae4SAndroid Build Coastguard WorkerAdded: 4.0 11*6236dae4SAndroid Build Coastguard WorkerMulti: boolean 12*6236dae4SAndroid Build Coastguard WorkerSee-also: 13*6236dae4SAndroid Build Coastguard Worker - fail-with-body 14*6236dae4SAndroid Build Coastguard Worker - fail-early 15*6236dae4SAndroid Build Coastguard WorkerExample: 16*6236dae4SAndroid Build Coastguard Worker - --fail $URL 17*6236dae4SAndroid Build Coastguard Worker--- 18*6236dae4SAndroid Build Coastguard Worker 19*6236dae4SAndroid Build Coastguard Worker# `--fail` 20*6236dae4SAndroid Build Coastguard Worker 21*6236dae4SAndroid Build Coastguard WorkerFail with error code 22 and with no response body output at all for HTTP 22*6236dae4SAndroid Build Coastguard Workertransfers returning HTTP response codes at 400 or greater. 23*6236dae4SAndroid Build Coastguard Worker 24*6236dae4SAndroid Build Coastguard WorkerIn normal cases when an HTTP server fails to deliver a document, it returns a 25*6236dae4SAndroid Build Coastguard Workerbody of text stating so (which often also describes why and more) and a 4xx 26*6236dae4SAndroid Build Coastguard WorkerHTTP response code. This command line option prevents curl from outputting 27*6236dae4SAndroid Build Coastguard Workerthat data and instead returns error 22 early. By default, curl does not 28*6236dae4SAndroid Build Coastguard Workerconsider HTTP response codes to indicate failure. 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard WorkerTo get both the error code and also save the content, use --fail-with-body 31*6236dae4SAndroid Build Coastguard Workerinstead. 32*6236dae4SAndroid Build Coastguard Worker 33*6236dae4SAndroid Build Coastguard WorkerThis method is not fail-safe and there are occasions where non-successful 34*6236dae4SAndroid Build Coastguard Workerresponse codes slip through, especially when authentication is involved 35*6236dae4SAndroid Build Coastguard Worker(response codes 401 and 407). 36