range.md (2050B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Long: range 5 Short: r 6 Help: Retrieve only the bytes within RANGE 7 Arg: <range> 8 Protocols: HTTP FTP SFTP FILE 9 Category: http ftp sftp file 10 Added: 4.0 11 Multi: single 12 See-also: 13 - continue-at 14 - append 15 Example: 16 - --range 22-44 $URL 17 --- 18 19 # `--range` 20 21 Retrieve a byte range (i.e. a partial document) from an HTTP/1.1, FTP or SFTP 22 server or a local FILE. Ranges can be specified in a number of ways. 23 24 ## 0-499 25 specifies the first 500 bytes 26 27 ## 500-999 28 specifies the second 500 bytes 29 30 ## -500 31 specifies the last 500 bytes 32 33 ## 9500- 34 specifies the bytes from offset 9500 and forward 35 36 ## 0-0,-1 37 specifies the first and last byte only(*)(HTTP) 38 39 ## 100-199,500-599 40 specifies two separate 100-byte ranges(*) (HTTP) 41 42 ## 43 44 (*) = NOTE that if specifying multiple ranges and the server supports it then 45 it replies with a multiple part response that curl returns as-is. It 46 contains meta information in addition to the requested bytes. Parsing or 47 otherwise transforming this response is the responsibility of the caller. 48 49 Only digit characters (0-9) are valid in the 'start' and 'stop' fields of the 50 'start-stop' range syntax. If a non-digit character is given in the range, the 51 server's response is unspecified, depending on the server's configuration. 52 53 Many HTTP/1.1 servers do not have this feature enabled, so that when you 54 attempt to get a range, curl instead gets the whole document. 55 56 FTP and SFTP range downloads only support the simple 'start-stop' syntax 57 (optionally with one of the numbers omitted). FTP use depends on the extended 58 FTP command SIZE. 59 60 When using this option for HTTP uploads using POST or PUT, functionality is 61 not guaranteed. The HTTP protocol has no standard interoperable resume upload 62 and curl uses a set of headers for this purpose that once proved working for 63 some servers and have been left for those who find that useful. 64 65 This command line option is mutually exclusive with --continue-at: you can only 66 use one of them for a single transfer.