1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_KEEP_SENDING_ON_ERROR
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_RESPONSE_CODE (3)
9  - CURLOPT_FAILONERROR (3)
10  - CURLOPT_HTTPHEADER (3)
11Protocol:
12  - HTTP
13Added-in: 7.51.0
14---
15
16# NAME
17
18CURLOPT_KEEP_SENDING_ON_ERROR - keep sending on early HTTP response \>= 300
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEEP_SENDING_ON_ERROR,
26                          long keep_sending);
27~~~
28
29# DESCRIPTION
30
31A long parameter set to 1 tells the library to keep sending the request body
32if the HTTP code returned is equal to or larger than 300. The default action
33would be to stop sending and close the stream or connection.
34
35This option is suitable for manual NTLM authentication, i.e. if an application
36does not use CURLOPT_HTTPAUTH(3), but instead sets "Authorization: NTLM ..."
37headers manually using CURLOPT_HTTPHEADER(3).
38
39Most applications do not need this option.
40
41# DEFAULT
42
430, stop sending on error
44
45# %PROTOCOLS%
46
47# EXAMPLE
48
49~~~c
50int main(void)
51{
52  CURL *curl = curl_easy_init();
53  if(curl) {
54    CURLcode ret;
55    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
56    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "sending data");
57    curl_easy_setopt(curl, CURLOPT_KEEP_SENDING_ON_ERROR, 1L);
58    ret = curl_easy_perform(curl);
59  }
60}
61~~~
62
63# %AVAILABILITY%
64
65# RETURN VALUE
66
67Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
68