Sortix main manual
This manual documents Sortix main. You can instead view this document in the latest official manual.
CURLOPT_FAILONERROR(3) | curl_easy_setopt options | CURLOPT_FAILONERROR(3) |
NAME
CURLOPT_FAILONERROR - request failure on HTTP response >= 400SYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FAILONERROR, long fail);
DESCRIPTION
A long parameter set to 1 tells the library to fail the request if the HTTP code returned is equal to or larger than 400. The default action would be to return the page normally, ignoring that code.DEFAULT
0, do not fail on errorPROTOCOLS
HTTPEXAMPLE
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
ret = curl_easy_perform(curl);
if(ret == CURLE_HTTP_RETURNED_ERROR) {
/* an HTTP response error problem */
}
}
AVAILABILITY
Along with HTTP.RETURN VALUE
Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.SEE ALSO
CURLOPT_HTTP200ALIASES(3), CURLOPT_KEEP_SENDING_ON_ERROR(3),May 17, 2022 | libcurl 7.84.0 |