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