Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
CURLOPT_FAILONERROR(3) | Library Functions Manual | 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
This functionality affects http onlyEXAMPLE
int main(void)
{
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
Added in curl 7.1RETURN VALUE
Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.SEE ALSO
CURLINFO_RESPONSE_CODE(3), CURLOPT_HTTP200ALIASES(3), CURLOPT_KEEP_SENDING_ON_ERROR(3)2024-12-21 | libcurl |