Buy commercial curl support from
WolfSSL. We help you work out your issues, debug your libcurl
applications, use the API, port to new platforms, add new features and more.
With a team lead by the curl founder himself.
[man-pages] Discrepancy between --fail-with-body and --fail
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Vincent MAILHOL via curl-users <curl-users_at_lists.haxx.se>
Date: Wed, 24 Apr 2024 00:14:55 +0900
Hello,
The documentation of --fail-with-body and --fail seems to contradict each other.
The manpage for --fail-with-body says [1]:
--fail-with-body
(HTTP) Return an error on server errors where the HTTP response
code is 400 or greater). In normal cases when an HTTP server fails
to deliver a document, it returns an HTML document stating so
(which often also describes why and more). This option allows curl
to output and save that content but also to return error 22.
This is an alternative option to -f, --fail which makes curl fail
for the same circumstances but without saving the content.
(...)
and --fail says [2]:
-f, --fail
(...)
This method is not fail-safe and there are occasions where
non-successful response codes slip through, especially when
authentication is involved (response codes 401 and 407).
(...)
By paraphrasing above quotations, we basically have three pieces of information:
1. --fail-with-body returns an error if the http response code is
400 or greater
2. --fail-with-body and --fail would fail under the same circumstances
3. for --fail, error code between 401 and 407 would "slip through"
Those three conditions result in a logical contradiction. At least one
of those should be incorrect. To the extent of my knowledge, the third
one seems incorrect, but not fully sure of that.
Thank you for your comments.
References:
[1] curl manpage, option --fail-with-body
Link: https://curl.se/docs/manpage.html#--fail-with-body
[2] curl manpage, option -f, --fail
Link: https://curl.se/docs/manpage.html#--fail
Yours sincerely,
Vincent Mailhol
Date: Wed, 24 Apr 2024 00:14:55 +0900
Hello,
The documentation of --fail-with-body and --fail seems to contradict each other.
The manpage for --fail-with-body says [1]:
--fail-with-body
(HTTP) Return an error on server errors where the HTTP response
code is 400 or greater). In normal cases when an HTTP server fails
to deliver a document, it returns an HTML document stating so
(which often also describes why and more). This option allows curl
to output and save that content but also to return error 22.
This is an alternative option to -f, --fail which makes curl fail
for the same circumstances but without saving the content.
(...)
and --fail says [2]:
-f, --fail
(...)
This method is not fail-safe and there are occasions where
non-successful response codes slip through, especially when
authentication is involved (response codes 401 and 407).
(...)
By paraphrasing above quotations, we basically have three pieces of information:
1. --fail-with-body returns an error if the http response code is
400 or greater
2. --fail-with-body and --fail would fail under the same circumstances
3. for --fail, error code between 401 and 407 would "slip through"
Those three conditions result in a logical contradiction. At least one
of those should be incorrect. To the extent of my knowledge, the third
one seems incorrect, but not fully sure of that.
Thank you for your comments.
References:
[1] curl manpage, option --fail-with-body
Link: https://curl.se/docs/manpage.html#--fail-with-body
[2] curl manpage, option -f, --fail
Link: https://curl.se/docs/manpage.html#--fail
Yours sincerely,
Vincent Mailhol
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2024-04-23