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

NAME

6       CURLOPT_RANGE - set byte range to request
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANGE, char *range);
12

DESCRIPTION

14       Pass  a  char  * as parameter, which should contain the specified range
15       you want to retrieve. It should be in the format "X-Y", where either  X
16       or Y may be left out and X and Y are byte indexes.
17
18       HTTP transfers also support several intervals, separated with commas as
19       in "X-Y,N-M". Using this kind of multiple intervals will cause the HTTP
20       server  to  send  the  response document in pieces (using standard MIME
21       separation techniques). Unfortunately, the HTTP standard (RFC 7233 sec‐
22       tion  3.1) allows servers to ignore range requests so even when you set
23       CURLOPT_RANGE(3) for a  request,  you  may  end  up  getting  the  full
24       response sent back.
25
26       For  RTSP,  the  formatting  of  a  range should follow RFC2326 Section
27       12.29. For RTSP, byte ranges are not permitted. Instead, ranges  should
28       be given in npt, utc, or smpte formats.
29
30       Pass a NULL to this option to disable the use of ranges.
31
32       The  application  does not have to keep the string around after setting
33       this option.
34

DEFAULT

36       NULL
37

PROTOCOLS

39       HTTP, FTP, FILE, RTSP and SFTP.
40

EXAMPLE

42       CURL *curl = curl_easy_init();
43       if(curl) {
44         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
45
46         /* get the first 200 bytes */
47         curl_easy_setopt(curl, CURLOPT_RANGE, "0-199");
48
49         /* Perform the request */
50         curl_easy_perform(curl);
51       }
52

AVAILABILITY

54       FILE since 7.18.0, RTSP since 7.20.0
55

RETURN VALUE

57       Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was  insuf‐
58       ficient heap space.
59

SEE ALSO

61       CURLOPT_RESUME_FROM(3),
62
63
64
65libcurl 7.64.0                 December 21, 2016              CURLOPT_RANGE(3)
Impressum