quickjs-tart

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

CURLOPT_RANGE.md (2457B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_RANGE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_LOW_SPEED_LIMIT (3)
      9   - CURLOPT_MAXFILESIZE_LARGE (3)
     10   - CURLOPT_MAX_RECV_SPEED_LARGE (3)
     11   - CURLOPT_RESUME_FROM (3)
     12 Protocol:
     13   - HTTP
     14   - FTP
     15   - FILE
     16   - RTSP
     17   - SFTP
     18 Added-in: 7.1
     19 ---
     20 
     21 # NAME
     22 
     23 CURLOPT_RANGE - byte range to request
     24 
     25 # SYNOPSIS
     26 
     27 ~~~c
     28 #include <curl/curl.h>
     29 
     30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANGE, char *range);
     31 ~~~
     32 
     33 # DESCRIPTION
     34 
     35 Pass a char pointer as parameter, which should contain the specified range you
     36 want to retrieve. It should be in the format "X-Y", where either X or Y may be
     37 left out and X and Y are byte indexes.
     38 
     39 HTTP transfers also support several intervals, separated with commas as in
     40 *"X-Y,N-M"*. Using this kind of multiple intervals causes the HTTP server
     41 to send the response document in pieces (using standard MIME separation
     42 techniques) as a multiple part response which libcurl returns as-is. It
     43 contains meta information in addition to the requested bytes. Parsing or
     44 otherwise transforming this response is the responsibility of the caller.
     45 
     46 Unfortunately, the HTTP standard (RFC 7233 section 3.1) allows servers to
     47 ignore range requests so even when you set CURLOPT_RANGE(3) for a request, you
     48 may end up getting the full response sent back.
     49 
     50 For RTSP, the formatting of a range should follow RFC 2326 Section 12.29. For
     51 RTSP, byte ranges are **not** permitted. Instead, ranges should be given in
     52 **npt**, **utc**, or **smpte** formats.
     53 
     54 For HTTP PUT uploads this option should not be used, since it may conflict with
     55 other options.
     56 
     57 Using this option multiple times makes the last set string override the
     58 previous ones. Set it to NULL to disable its use again.
     59 
     60 The application does not have to keep the string around after setting this
     61 option.
     62 
     63 # DEFAULT
     64 
     65 NULL
     66 
     67 # %PROTOCOLS%
     68 
     69 # EXAMPLE
     70 
     71 ~~~c
     72 int main(void)
     73 {
     74   CURL *curl = curl_easy_init();
     75   if(curl) {
     76     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     77 
     78     /* get the first 200 bytes */
     79     curl_easy_setopt(curl, CURLOPT_RANGE, "0-199");
     80 
     81     /* Perform the request */
     82     curl_easy_perform(curl);
     83   }
     84 }
     85 ~~~
     86 
     87 # HISTORY
     88 
     89 FILE since 7.18.0, RTSP since 7.20.0
     90 
     91 # %AVAILABILITY%
     92 
     93 # RETURN VALUE
     94 
     95 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     96 
     97 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     98 libcurl-errors(3).