1CURLOPT_POSTFIELDSIZE(3)   curl_easy_setopt options   CURLOPT_POSTFIELDSIZE(3)
2
3
4

NAME

6       CURLOPT_POSTFIELDSIZE - size of POST data pointed to
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE, long size);
12

DESCRIPTION

14       If  you  want  to  post  data to the server without having libcurl do a
15       strlen() to measure the data size, this option must be used. When  this
16       option  is  used  you  can  post  fully binary data, which otherwise is
17       likely to fail. If this size  is  set  to  -1,  the  library  will  use
18       strlen() to get the size.
19
20       If you post more than 2GB, use CURLOPT_POSTFIELDSIZE_LARGE(3).
21

DEFAULT

23       -1
24

PROTOCOLS

26       HTTP
27

EXAMPLE

29       CURL *curl = curl_easy_init();
30       if(curl) {
31         const char *data = "data to send";
32
33         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
34
35         /* size of the POST data */
36         curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data));
37
38         curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
39
40         curl_easy_perform(curl);
41       }
42

AVAILABILITY

44       Along with HTTP
45

RETURN VALUE

47       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
48

SEE ALSO

50       CURLOPT_POSTFIELDS(3), CURLOPT_POSTFIELDSIZE_LARGE(3),
51
52
53
54libcurl 7.85.0                   May 17, 2022         CURLOPT_POSTFIELDSIZE(3)
Impressum