quickjs-tart

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

CURLINFO_EARLYDATA_SENT_T.md (1848B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLINFO_EARLYDATA_SENT_T
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_easy_getinfo (3)
      9   - curl_easy_setopt (3)
     10 Protocol:
     11   - TLS
     12 TLS-backend:
     13   - GnuTLS
     14 Added-in: 8.11.0
     15 ---
     16 
     17 # NAME
     18 
     19 CURLINFO_EARLYDATA_SENT_T - get the number of bytes sent as TLS early data
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EARLYDATA_SENT_T,
     27                            curl_off_t *amount);
     28 ~~~
     29 
     30 # DESCRIPTION
     31 
     32 Pass a pointer to an *curl_off_t* to receive the total amount of bytes that
     33 were sent to the server as TLSv1.3 early data. When no TLS early
     34 data is used, this reports 0.
     35 
     36 TLS early data is only attempted when CURLSSLOPT_EARLYDATA is set for the
     37 transfer. In addition, it is only used by libcurl when a TLS session exists
     38 that announces support.
     39 
     40 The amount is **negative** when the sent data was rejected
     41 by the server. TLS allows a server that announces support for early data to
     42 reject any attempt to use it at its own discretion. When for example 127
     43 bytes had been sent, but were rejected, it reports -127 as the amount "sent".
     44 
     45 # %PROTOCOLS%
     46 
     47 # EXAMPLE
     48 
     49 ~~~c
     50 int main(void)
     51 {
     52   CURL *curl = curl_easy_init();
     53   if(curl) {
     54     CURLcode res;
     55     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     56 
     57     /* Perform the request */
     58     res = curl_easy_perform(curl);
     59 
     60     if(!res) {
     61       curl_off_t amount;
     62       res = curl_easy_getinfo(curl, CURLINFO_EARLYDATA_SENT_T, &amount);
     63       if(!res) {
     64         printf("TLS earlydata: %" CURL_FORMAT_CURL_OFF_T " bytes\n", amount);
     65       }
     66     }
     67   }
     68 }
     69 ~~~
     70 
     71 # %AVAILABILITY%
     72 
     73 # RETURN VALUE
     74 
     75 curl_easy_getinfo(3) returns a CURLcode indicating success or error.
     76 
     77 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     78 libcurl-errors(3).