GNURLOPT_RANGE(3)
π GNURLOPT_RANGE(3) π
okay bestie, this page lives in the curl_easy_setopt options manual, and itβs all about telling a transfer βbestie, just gimme this byte range, not the whole thingβ π
πΈ NAME πΈ
CURLOPT_RANGE β set byte range to request β¨
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANGE, char *range);
π DESCRIPTION π
- Pass a
char *as parameter, which should contain the specified range you want to retrieve. It should be in the format"X-Y", where either X or Y may be left out and X and Y are byte indexes. - HTTP transfers also support several intervals, separated with commas as in
"X-Y,N-M". Using this kind of multiple intervals will cause the HTTP server to send the response document in pieces (using standard MIME separation techniques). Unfortunately, the HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests so even when you setCURLOPT_RANGE(3)for a request, you may end up getting the full response sent back π like okay server, read the room. - For RTSP, the formatting of a range should follow RFC2326 Section 12.29. For RTSP, byte ranges are not permitted. Instead, ranges should be given in
npt,utc, orsmpteformats. - For HTTP PUT uploads this option should not be used, since it may conflict with other options. If you need to upload arbitrary parts of a file (like for Amazon's web services) support is limited. We suggest set resume position using
CURLOPT_RESUME_FROM(3), set end (resume+size) position usingCURLOPT_INFILESIZE(3)and seek to the resume position before initiating the transfer for each part. For more information refer tohttps://curl.haxx.se/mail/lib-2019-05/0012.html - Pass a
NULLto this option to disable the use of ranges. - The application does not have to keep the string around after setting this option π«Ά
π DEFAULT π
NULL
π₯ PROTOCOLS π₯
HTTP, FTP, FILE, RTSP and SFTP π
β¨ EXAMPLE β¨
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* get the first 200 bytes */
curl_easy_setopt(curl, CURLOPT_RANGE, "0-199");
/* Perform the request */
curl_easy_perform(curl);
}
β AVAILABILITY β
FILE since 7.18.0, RTSP since 7.20.0 π¦
π RETURN VALUE π
Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
π SEE ALSO π
CURLOPT_RESUME_FROM(3),β thatβs the SEE ALSO bestie π«
okay bye bestie π β source/version is libcurl 7.37.0, dated 17 Jun 2014, and the page is GNURLOPT_RANGE(3) β¨π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms