1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Short: b 5Long: cookie 6Arg: <data|filename> 7Protocols: HTTP 8Help: Send cookies from string/load from file 9Category: http 10Added: 4.9 11Multi: append 12See-also: 13 - cookie-jar 14 - junk-session-cookies 15Example: 16 - -b "" $URL 17 - -b cookiefile $URL 18 - -b cookiefile -c cookiefile $URL 19 - -b name=Jane $URL 20--- 21 22# `--cookie` 23 24This option has two slightly separate cookie sending functions. 25 26Either: pass the exact data to send to the HTTP server in the Cookie header. 27It is supposedly data previously received from the server in a `Set-Cookie:` 28line. The data should be in the format `NAME1=VALUE1; NAME2=VALUE2`. When 29given a set of specific cookies, curl populates its cookie header with this 30content explicitly in all outgoing request(s). If multiple requests are done 31due to authentication, followed redirects or similar, they all get this cookie 32header passed on. 33 34Or: If no `=` symbol is used in the argument, it is instead treated as a 35filename to read previously stored cookie from. This option also activates the 36cookie engine which makes curl record incoming cookies, which may be handy if 37you are using this in combination with the --location option or do multiple 38URL transfers on the same invoke. 39 40If the filename is a single minus ("-"), curl reads the contents from stdin. 41If the filename is an empty string ("") and is the only cookie input, curl 42activates the cookie engine without any cookies. 43 44The file format of the file to read cookies from should be plain HTTP headers 45(Set-Cookie style) or the Netscape/Mozilla cookie file format. 46 47The file specified with --cookie is only used as input. No cookies are written 48to that file. To store cookies, use the --cookie-jar option. 49 50If you use the Set-Cookie file format and do not specify a domain then the 51cookie is not sent since the domain never matches. To address this, set a 52domain in Set-Cookie line (doing that includes subdomains) or preferably: use 53the Netscape format. 54 55Users often want to both read cookies from a file and write updated cookies 56back to a file, so using both --cookie and --cookie-jar in the same command 57line is common. 58 59If curl is built with PSL (**Public Suffix List**) support, it detects and 60discards cookies that are specified for such suffix domains that should not be 61allowed to have cookies. If curl is *not* built with PSL support, it has no 62ability to stop super cookies. 63