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: remote-header-name |
| 4 | Short: J |
| 5 | Protocols: HTTP |
| 6 | Help: Use the header-provided filename |
| 7 | Category: output |
| 8 | Example: -OJ https://example.com/file |
| 9 | Added: 7.20.0 |
| 10 | See-also: remote-name |
| 11 | Multi: boolean |
| 12 | --- |
| 13 | This option tells the --remote-name option to use the server-specified |
| 14 | Content-Disposition filename instead of extracting a filename from the URL. If |
| 15 | the server-provided file name contains a path, that will be stripped off |
| 16 | before the file name is used. |
| 17 | |
| 18 | The file is saved in the current directory, or in the directory specified with |
| 19 | --output-dir. |
| 20 | |
| 21 | If the server specifies a file name and a file with that name already exists |
| 22 | in the destination directory, it will not be overwritten and an error will |
| 23 | occur. If the server does not specify a file name then this option has no |
| 24 | effect. |
| 25 | |
| 26 | There's no attempt to decode %-sequences (yet) in the provided file name, so |
| 27 | this option may provide you with rather unexpected file names. |
| 28 | |
| 29 | **WARNING**: Exercise judicious use of this option, especially on Windows. A |
| 30 | rogue server could send you the name of a DLL or other file that could be |
| 31 | loaded automatically by Windows or some third party software. |