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 WorkerShort: b 5*6236dae4SAndroid Build Coastguard WorkerLong: cookie 6*6236dae4SAndroid Build Coastguard WorkerArg: <data|filename> 7*6236dae4SAndroid Build Coastguard WorkerProtocols: HTTP 8*6236dae4SAndroid Build Coastguard WorkerHelp: Send cookies from string/load from file 9*6236dae4SAndroid Build Coastguard WorkerCategory: http 10*6236dae4SAndroid Build Coastguard WorkerAdded: 4.9 11*6236dae4SAndroid Build Coastguard WorkerMulti: append 12*6236dae4SAndroid Build Coastguard WorkerSee-also: 13*6236dae4SAndroid Build Coastguard Worker - cookie-jar 14*6236dae4SAndroid Build Coastguard Worker - junk-session-cookies 15*6236dae4SAndroid Build Coastguard WorkerExample: 16*6236dae4SAndroid Build Coastguard Worker - -b "" $URL 17*6236dae4SAndroid Build Coastguard Worker - -b cookiefile $URL 18*6236dae4SAndroid Build Coastguard Worker - -b cookiefile -c cookiefile $URL 19*6236dae4SAndroid Build Coastguard Worker - -b name=Jane $URL 20*6236dae4SAndroid Build Coastguard Worker--- 21*6236dae4SAndroid Build Coastguard Worker 22*6236dae4SAndroid Build Coastguard Worker# `--cookie` 23*6236dae4SAndroid Build Coastguard Worker 24*6236dae4SAndroid Build Coastguard WorkerThis option has two slightly separate cookie sending functions. 25*6236dae4SAndroid Build Coastguard Worker 26*6236dae4SAndroid Build Coastguard WorkerEither: pass the exact data to send to the HTTP server in the Cookie header. 27*6236dae4SAndroid Build Coastguard WorkerIt is supposedly data previously received from the server in a `Set-Cookie:` 28*6236dae4SAndroid Build Coastguard Workerline. The data should be in the format `NAME1=VALUE1; NAME2=VALUE2`. When 29*6236dae4SAndroid Build Coastguard Workergiven a set of specific cookies, curl populates its cookie header with this 30*6236dae4SAndroid Build Coastguard Workercontent explicitly in all outgoing request(s). If multiple requests are done 31*6236dae4SAndroid Build Coastguard Workerdue to authentication, followed redirects or similar, they all get this cookie 32*6236dae4SAndroid Build Coastguard Workerheader passed on. 33*6236dae4SAndroid Build Coastguard Worker 34*6236dae4SAndroid Build Coastguard WorkerOr: If no `=` symbol is used in the argument, it is instead treated as a 35*6236dae4SAndroid Build Coastguard Workerfilename to read previously stored cookie from. This option also activates the 36*6236dae4SAndroid Build Coastguard Workercookie engine which makes curl record incoming cookies, which may be handy if 37*6236dae4SAndroid Build Coastguard Workeryou are using this in combination with the --location option or do multiple 38*6236dae4SAndroid Build Coastguard WorkerURL transfers on the same invoke. 39*6236dae4SAndroid Build Coastguard Worker 40*6236dae4SAndroid Build Coastguard WorkerIf the filename is a single minus ("-"), curl reads the contents from stdin. 41*6236dae4SAndroid Build Coastguard WorkerIf the filename is an empty string ("") and is the only cookie input, curl 42*6236dae4SAndroid Build Coastguard Workeractivates the cookie engine without any cookies. 43*6236dae4SAndroid Build Coastguard Worker 44*6236dae4SAndroid Build Coastguard WorkerThe file format of the file to read cookies from should be plain HTTP headers 45*6236dae4SAndroid Build Coastguard Worker(Set-Cookie style) or the Netscape/Mozilla cookie file format. 46*6236dae4SAndroid Build Coastguard Worker 47*6236dae4SAndroid Build Coastguard WorkerThe file specified with --cookie is only used as input. No cookies are written 48*6236dae4SAndroid Build Coastguard Workerto that file. To store cookies, use the --cookie-jar option. 49*6236dae4SAndroid Build Coastguard Worker 50*6236dae4SAndroid Build Coastguard WorkerIf you use the Set-Cookie file format and do not specify a domain then the 51*6236dae4SAndroid Build Coastguard Workercookie is not sent since the domain never matches. To address this, set a 52*6236dae4SAndroid Build Coastguard Workerdomain in Set-Cookie line (doing that includes subdomains) or preferably: use 53*6236dae4SAndroid Build Coastguard Workerthe Netscape format. 54*6236dae4SAndroid Build Coastguard Worker 55*6236dae4SAndroid Build Coastguard WorkerUsers often want to both read cookies from a file and write updated cookies 56*6236dae4SAndroid Build Coastguard Workerback to a file, so using both --cookie and --cookie-jar in the same command 57*6236dae4SAndroid Build Coastguard Workerline is common. 58*6236dae4SAndroid Build Coastguard Worker 59*6236dae4SAndroid Build Coastguard WorkerIf curl is built with PSL (**Public Suffix List**) support, it detects and 60*6236dae4SAndroid Build Coastguard Workerdiscards cookies that are specified for such suffix domains that should not be 61*6236dae4SAndroid Build Coastguard Workerallowed to have cookies. If curl is *not* built with PSL support, it has no 62*6236dae4SAndroid Build Coastguard Workerability to stop super cookies. 63