xref: /aosp_15_r20/external/curl/docs/cmdline-opts/remote-header-name.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: remote-header-name
5*6236dae4SAndroid Build Coastguard WorkerShort: J
6*6236dae4SAndroid Build Coastguard WorkerProtocols: HTTP
7*6236dae4SAndroid Build Coastguard WorkerHelp: Use the header-provided filename
8*6236dae4SAndroid Build Coastguard WorkerCategory: output
9*6236dae4SAndroid Build Coastguard WorkerAdded: 7.20.0
10*6236dae4SAndroid Build Coastguard WorkerMulti: boolean
11*6236dae4SAndroid Build Coastguard WorkerSee-also:
12*6236dae4SAndroid Build Coastguard Worker  - remote-name
13*6236dae4SAndroid Build Coastguard WorkerExample:
14*6236dae4SAndroid Build Coastguard Worker  - -OJ https://example.com/file
15*6236dae4SAndroid Build Coastguard Worker---
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Worker# `--remote-header-name`
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard WorkerTell the --remote-name option to use the server-specified Content-Disposition
20*6236dae4SAndroid Build Coastguard Workerfilename instead of extracting a filename from the URL. If the server-provided
21*6236dae4SAndroid Build Coastguard Workerfilename contains a path, that is stripped off before the filename is used.
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard WorkerThe file is saved in the current directory, or in the directory specified with
24*6236dae4SAndroid Build Coastguard Worker--output-dir.
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerIf the server specifies a filename and a file with that name already exists in
27*6236dae4SAndroid Build Coastguard Workerthe destination directory, it is not overwritten and an error occurs - unless
28*6236dae4SAndroid Build Coastguard Workeryou allow it by using the --clobber option. If the server does not specify a
29*6236dae4SAndroid Build Coastguard Workerfilename then this option has no effect.
30*6236dae4SAndroid Build Coastguard Worker
31*6236dae4SAndroid Build Coastguard WorkerThere is no attempt to decode %-sequences (yet) in the provided filename, so
32*6236dae4SAndroid Build Coastguard Workerthis option may provide you with rather unexpected filenames.
33*6236dae4SAndroid Build Coastguard Worker
34*6236dae4SAndroid Build Coastguard WorkerThis feature uses the name from the `filename` field, it does not yet support
35*6236dae4SAndroid Build Coastguard Workerthe `filename*` field (filenames with explicit character sets).
36*6236dae4SAndroid Build Coastguard Worker
37*6236dae4SAndroid Build Coastguard Worker**WARNING**: Exercise judicious use of this option, especially on Windows. A
38*6236dae4SAndroid Build Coastguard Workerrogue server could send you the name of a DLL or other file that could be
39*6236dae4SAndroid Build Coastguard Workerloaded automatically by Windows or some third party software.
40