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