quickjs-tart

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

CURLOPT_HEADER.md (1808B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_HEADER
      5 Section: 3
      6 Source: libcurl
      7 Protocol:
      8   - HTTP
      9   - FTP
     10   - IMAP
     11   - POP3
     12   - SMTP
     13 See-also:
     14   - CURLOPT_HEADERFUNCTION (3)
     15   - CURLOPT_HTTPHEADER (3)
     16 Added-in: 7.1
     17 ---
     18 
     19 # NAME
     20 
     21 CURLOPT_HEADER - pass headers to the data stream
     22 
     23 # SYNOPSIS
     24 
     25 ~~~c
     26 #include <curl/curl.h>
     27 
     28 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff);
     29 ~~~
     30 
     31 # DESCRIPTION
     32 
     33 Pass the long value *onoff* set to 1 to ask libcurl to include the headers
     34 in the write callback (CURLOPT_WRITEFUNCTION(3)). This option is
     35 relevant for protocols that actually have headers or other meta-data (like
     36 HTTP and FTP).
     37 
     38 When asking to get the headers passed to the same callback as the body, it is
     39 not possible to accurately separate them again without detailed knowledge
     40 about the protocol in use.
     41 
     42 Further: the CURLOPT_WRITEFUNCTION(3) callback is limited to only ever
     43 get a maximum of *CURL_MAX_WRITE_SIZE* bytes passed to it (16KB), while a
     44 header can be longer and the CURLOPT_HEADERFUNCTION(3) supports getting
     45 called with headers up to *CURL_MAX_HTTP_HEADER* bytes big (100KB).
     46 
     47 It is often better to use CURLOPT_HEADERFUNCTION(3) to get the header
     48 data separately.
     49 
     50 While named confusingly similar, CURLOPT_HTTPHEADER(3) is used to set
     51 custom HTTP headers.
     52 
     53 # DEFAULT
     54 
     55 0
     56 
     57 # %PROTOCOLS%
     58 
     59 # EXAMPLE
     60 
     61 ~~~c
     62 int main(void)
     63 {
     64   CURL *curl = curl_easy_init();
     65   if(curl) {
     66     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     67 
     68     curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
     69 
     70     curl_easy_perform(curl);
     71   }
     72 }
     73 ~~~
     74 
     75 # %AVAILABILITY%
     76 
     77 # RETURN VALUE
     78 
     79 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     80 
     81 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     82 libcurl-errors(3).