CURLOPT_KEEP_SENDING_ON_ERROR(3)

πŸ’… CURLOPT_KEEP_SENDING_ON_ERROR(3) ✨

okay bestie, welcome to the Library Functions Manual page for CURLOPT_KEEP_SENDING_ON_ERROR(3) β€” yes the title is a whole mouthful, we love her anyway 🫢


🌸 NAME 🌸

CURLOPT_KEEP_SENDING_ON_ERROR β€” keep sending on early HTTP response >= 300 πŸŽ€


⭐ SYNOPSIS ⭐

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEEP_SENDING_ON_ERROR,
                          long keep_sending);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: you set this long parameter to 1, and you're literally telling the library "bestie, keep sending the request body even if the HTTP code that came back is equal to or larger than 300." The default behavior is the opposite β€” it stops sending and closes the stream or connection. πŸ’€

This option is suitable for manual NTLM authentication, i.e. if an application does not use CURLOPT_HTTPAUTH(3), but instead sets "Authorization: NTLM ..." headers manually using CURLOPT_HTTPHEADER(3). iykyk πŸ‘‘

Most applications do not need this option. fr fr, like, most of y'all can scroll past. πŸ™ˆ


πŸŽ€ DEFAULT πŸŽ€

0, stop sending on error πŸ›‘


🌈 PROTOCOLS 🌈

This functionality affects http only ✨


πŸ”₯ EXAMPLE πŸ”₯

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "sending data");
    curl_easy_setopt(curl, CURLOPT_KEEP_SENDING_ON_ERROR, 1L);
    result = curl_easy_perform(curl);
  }
}

look at her go, main character energy honestly πŸ’œ


πŸ’– AVAILABILITY πŸ’–

Added in curl 7.51.0 β€” she's been iconic since day one, periodt πŸŽ€


🫢 RETURN VALUE 🫢

curl_easy_setopt(3) returns a CURLcode indicating success or error. ⭐

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). 😭


🧚 SEE ALSO 🧚


libcurl Β· 2026-10-12 Β· CURLOPT_KEEP_SENDING_ON_ERROR(3) β€” mwah, that's the page, go slay your HTTP requests bestie πŸ’…πŸŒˆπŸŽ€

πŸ“¦ where this page comes from