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: config 5*6236dae4SAndroid Build Coastguard WorkerArg: <file> 6*6236dae4SAndroid Build Coastguard WorkerHelp: Read config from a file 7*6236dae4SAndroid Build Coastguard WorkerShort: K 8*6236dae4SAndroid Build Coastguard WorkerCategory: curl 9*6236dae4SAndroid Build Coastguard WorkerAdded: 4.10 10*6236dae4SAndroid Build Coastguard WorkerMulti: append 11*6236dae4SAndroid Build Coastguard WorkerSee-also: 12*6236dae4SAndroid Build Coastguard Worker - disable 13*6236dae4SAndroid Build Coastguard WorkerExample: 14*6236dae4SAndroid Build Coastguard Worker - --config file.txt $URL 15*6236dae4SAndroid Build Coastguard Worker--- 16*6236dae4SAndroid Build Coastguard Worker 17*6236dae4SAndroid Build Coastguard Worker# `--config` 18*6236dae4SAndroid Build Coastguard Worker 19*6236dae4SAndroid Build Coastguard WorkerSpecify a text file to read curl arguments from. The command line arguments 20*6236dae4SAndroid Build Coastguard Workerfound in the text file are used as if they were provided on the command 21*6236dae4SAndroid Build Coastguard Workerline. 22*6236dae4SAndroid Build Coastguard Worker 23*6236dae4SAndroid Build Coastguard WorkerOptions and their parameters must be specified on the same line in the file, 24*6236dae4SAndroid Build Coastguard Workerseparated by whitespace, colon, or the equals sign. Long option names can 25*6236dae4SAndroid Build Coastguard Workeroptionally be given in the config file without the initial double dashes and 26*6236dae4SAndroid Build Coastguard Workerif so, the colon or equals characters can be used as separators. If the option 27*6236dae4SAndroid Build Coastguard Workeris specified with one or two dashes, there can be no colon or equals character 28*6236dae4SAndroid Build Coastguard Workerbetween the option and its parameter. 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard WorkerIf the parameter contains whitespace or starts with a colon (:) or equals sign 31*6236dae4SAndroid Build Coastguard Worker(=), it must be specified enclosed within double quotes ("like this"). Within 32*6236dae4SAndroid Build Coastguard Workerdouble quotes the following escape sequences are available: \\, \", \t, \n, \r 33*6236dae4SAndroid Build Coastguard Workerand \v. A backslash preceding any other letter is ignored. 34*6236dae4SAndroid Build Coastguard Worker 35*6236dae4SAndroid Build Coastguard WorkerIf the first non-blank column of a config line is a '#' character, that line 36*6236dae4SAndroid Build Coastguard Workeris treated as a comment. 37*6236dae4SAndroid Build Coastguard Worker 38*6236dae4SAndroid Build Coastguard WorkerOnly write one option per physical line in the config file. A single line is 39*6236dae4SAndroid Build Coastguard Workerrequired to be no more than 10 megabytes (since 8.2.0). 40*6236dae4SAndroid Build Coastguard Worker 41*6236dae4SAndroid Build Coastguard WorkerSpecify the filename to --config as minus "-" to make curl read the file from 42*6236dae4SAndroid Build Coastguard Workerstdin. 43*6236dae4SAndroid Build Coastguard Worker 44*6236dae4SAndroid Build Coastguard WorkerNote that to be able to specify a URL in the config file, you need to specify 45*6236dae4SAndroid Build Coastguard Workerit using the --url option, and not by simply writing the URL on its own 46*6236dae4SAndroid Build Coastguard Workerline. So, it could look similar to this: 47*6236dae4SAndroid Build Coastguard Worker 48*6236dae4SAndroid Build Coastguard Worker url = "https://curl.se/docs/" 49*6236dae4SAndroid Build Coastguard Worker 50*6236dae4SAndroid Build Coastguard Worker # --- Example file --- 51*6236dae4SAndroid Build Coastguard Worker # this is a comment 52*6236dae4SAndroid Build Coastguard Worker url = "example.com" 53*6236dae4SAndroid Build Coastguard Worker output = "curlhere.html" 54*6236dae4SAndroid Build Coastguard Worker user-agent = "superagent/1.0" 55*6236dae4SAndroid Build Coastguard Worker 56*6236dae4SAndroid Build Coastguard Worker # and fetch another URL too 57*6236dae4SAndroid Build Coastguard Worker url = "example.com/docs/manpage.html" 58*6236dae4SAndroid Build Coastguard Worker -O 59*6236dae4SAndroid Build Coastguard Worker referer = "http://nowhereatall.example.com/" 60*6236dae4SAndroid Build Coastguard Worker # --- End of example file --- 61*6236dae4SAndroid Build Coastguard Worker 62*6236dae4SAndroid Build Coastguard WorkerWhen curl is invoked, it (unless --disable is used) checks for a default 63*6236dae4SAndroid Build Coastguard Workerconfig file and uses it if found, even when --config is used. The default 64*6236dae4SAndroid Build Coastguard Workerconfig file is checked for in the following places in this order: 65*6236dae4SAndroid Build Coastguard Worker 66*6236dae4SAndroid Build Coastguard Worker1) **"$CURL_HOME/.curlrc"** 67*6236dae4SAndroid Build Coastguard Worker 68*6236dae4SAndroid Build Coastguard Worker2) **"$XDG_CONFIG_HOME/curlrc"** (Added in 7.73.0) 69*6236dae4SAndroid Build Coastguard Worker 70*6236dae4SAndroid Build Coastguard Worker3) **"$HOME/.curlrc"** 71*6236dae4SAndroid Build Coastguard Worker 72*6236dae4SAndroid Build Coastguard Worker4) Windows: **"%USERPROFILE%\.curlrc"** 73*6236dae4SAndroid Build Coastguard Worker 74*6236dae4SAndroid Build Coastguard Worker5) Windows: **"%APPDATA%\.curlrc"** 75*6236dae4SAndroid Build Coastguard Worker 76*6236dae4SAndroid Build Coastguard Worker6) Windows: **"%USERPROFILE%\Application Data\.curlrc"** 77*6236dae4SAndroid Build Coastguard Worker 78*6236dae4SAndroid Build Coastguard Worker7) Non-Windows: use getpwuid to find the home directory 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard Worker8) On Windows, if it finds no *.curlrc* file in the sequence described above, it 81*6236dae4SAndroid Build Coastguard Workerchecks for one in the same directory the curl executable is placed. 82*6236dae4SAndroid Build Coastguard Worker 83*6236dae4SAndroid Build Coastguard WorkerOn Windows two filenames are checked per location: *.curlrc* and *_curlrc*, 84*6236dae4SAndroid Build Coastguard Workerpreferring the former. Older versions on Windows checked for *_curlrc* only. 85