quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_POSTFIELDSIZE_LARGE.md (1628B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_POSTFIELDSIZE_LARGE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_COPYPOSTFIELDS (3)
      9   - CURLOPT_POSTFIELDS (3)
     10   - CURLOPT_POSTFIELDSIZE (3)
     11 Protocol:
     12   - HTTP
     13 Added-in: 7.11.1
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_POSTFIELDSIZE_LARGE - size of POST data pointed to
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE_LARGE,
     26                           curl_off_t size);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 If you want to post static data to the server without having libcurl do a
     32 strlen() to measure the data size, this option must be used. When this option
     33 is used you can post fully binary data, which otherwise is likely to fail. If
     34 this size is set to -1, libcurl uses strlen() to get the size or relies on the
     35 CURLOPT_READFUNCTION(3) (if used) to signal the end of data.
     36 
     37 # DEFAULT
     38 
     39 -1
     40 
     41 # %PROTOCOLS%
     42 
     43 # EXAMPLE
     44 
     45 ~~~c
     46 extern char *large_chunk; /* pointer to somewhere */
     47 
     48 int main(void)
     49 {
     50   CURL *curl = curl_easy_init();
     51   if(curl) {
     52     const char *data = large_chunk;
     53     curl_off_t length_of_data = 12345; /* set somehow */
     54 
     55     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     56 
     57     /* size of the POST data */
     58     curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length_of_data);
     59 
     60     curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
     61 
     62     curl_easy_perform(curl);
     63   }
     64 }
     65 ~~~
     66 
     67 # %AVAILABILITY%
     68 
     69 # RETURN VALUE
     70 
     71 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     72 
     73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     74 libcurl-errors(3).