cookie.d 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  2. SPDX-License-Identifier: curl
  3. Short: b
  4. Long: cookie
  5. Arg: <data|filename>
  6. Protocols: HTTP
  7. Help: Send cookies from string/file
  8. Category: http
  9. Example: -b cookiefile $URL
  10. Example: -b cookiefile -c cookiefile $URL
  11. See-also: cookie-jar junk-session-cookies
  12. Added: 4.9
  13. ---
  14. Pass the data to the HTTP server in the Cookie header. It is supposedly the
  15. data previously received from the server in a "Set-Cookie:" line. The data
  16. should be in the format "NAME1=VALUE1; NAME2=VALUE2". This makes curl use the
  17. cookie header with this content explicitly in all outgoing request(s). If
  18. multiple requests are done due to authentication, followed redirects or
  19. similar, they will all get this cookie passed on.
  20. If no '=' symbol is used in the argument, it is instead treated as a filename
  21. to read previously stored cookie from. This option also activates the cookie
  22. engine which will make curl record incoming cookies, which may be handy if
  23. you are using this in combination with the --location option or do multiple URL
  24. transfers on the same invoke. If the file name is exactly a minus ("-"), curl
  25. will instead read the contents from stdin.
  26. The file format of the file to read cookies from should be plain HTTP headers
  27. (Set-Cookie style) or the Netscape/Mozilla cookie file format.
  28. The file specified with --cookie is only used as input. No cookies will be
  29. written to the file. To store cookies, use the --cookie-jar option.
  30. If you use the Set-Cookie file format and do not specify a domain then the
  31. cookie is not sent since the domain will never match. To address this, set a
  32. domain in Set-Cookie line (doing that will include sub-domains) or preferably:
  33. use the Netscape format.
  34. This option can be used multiple times.
  35. Users often want to both read cookies from a file and write updated cookies
  36. back to a file, so using both --cookie and --cookie-jar in the same command
  37. line is common.