blob: f49d40472b7a8da18f7030bc11b839e3f085ee0d [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
2SPDX-License-Identifier: curl
3Long: range
4Short: r
5Help: Retrieve only the bytes within RANGE
6Arg: <range>
7Protocols: HTTP FTP SFTP FILE
8Category: http ftp sftp file
9Example: --range 22-44 $URL
10Added: 4.0
11See-also: continue-at append
12Multi: single
13---
14Retrieve a byte range (i.e. a partial document) from an HTTP/1.1, FTP or SFTP
15server or a local FILE. Ranges can be specified in a number of ways.
16.RS
17.TP 10
18.B 0-499
19specifies the first 500 bytes
20.TP
21.B 500-999
22specifies the second 500 bytes
23.TP
24.B -500
25specifies the last 500 bytes
26.TP
27.B 9500-
28specifies the bytes from offset 9500 and forward
29.TP
30.B 0-0,-1
31specifies the first and last byte only(*)(HTTP)
32.TP
33.B 100-199,500-599
34specifies two separate 100-byte ranges(*) (HTTP)
35.RE
36.IP
37(*) = NOTE that this will cause the server to reply with a multipart
38response, which will be returned as-is by curl! Parsing or otherwise
39transforming this response is the responsibility of the caller.
40
41Only digit characters (0-9) are valid in the 'start' and 'stop' fields of the
42'start-stop' range syntax. If a non-digit character is given in the range,
43the server's response will be unspecified, depending on the server's
44configuration.
45
46You should also be aware that many HTTP/1.1 servers do not have this feature
47enabled, so that when you attempt to get a range, you will instead get the
48whole document.
49
50FTP and SFTP range downloads only support the simple 'start-stop' syntax
51(optionally with one of the numbers omitted). FTP use depends on the extended
52FTP command SIZE.