xref: /aosp_15_r20/external/curl/docs/cmdline-opts/cookie-jar.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 WorkerShort: c
5*6236dae4SAndroid Build Coastguard WorkerLong: cookie-jar
6*6236dae4SAndroid Build Coastguard WorkerArg: <filename>
7*6236dae4SAndroid Build Coastguard WorkerProtocols: HTTP
8*6236dae4SAndroid Build Coastguard WorkerHelp: Save cookies to <filename> after operation
9*6236dae4SAndroid Build Coastguard WorkerCategory: http
10*6236dae4SAndroid Build Coastguard WorkerAdded: 7.9
11*6236dae4SAndroid Build Coastguard WorkerMulti: single
12*6236dae4SAndroid Build Coastguard WorkerSee-also:
13*6236dae4SAndroid Build Coastguard Worker  - cookie
14*6236dae4SAndroid Build Coastguard Worker  - junk-session-cookies
15*6236dae4SAndroid Build Coastguard WorkerExample:
16*6236dae4SAndroid Build Coastguard Worker  - -c store-here.txt $URL
17*6236dae4SAndroid Build Coastguard Worker  - -c store-here.txt -b read-these $URL
18*6236dae4SAndroid Build Coastguard Worker---
19*6236dae4SAndroid Build Coastguard Worker
20*6236dae4SAndroid Build Coastguard Worker# `--cookie-jar`
21*6236dae4SAndroid Build Coastguard Worker
22*6236dae4SAndroid Build Coastguard WorkerSpecify to which file you want curl to write all cookies after a completed
23*6236dae4SAndroid Build Coastguard Workeroperation. Curl writes all cookies from its in-memory cookie storage to the
24*6236dae4SAndroid Build Coastguard Workergiven file at the end of operations. Even if no cookies are known, a file is
25*6236dae4SAndroid Build Coastguard Workercreated so that it removes any formerly existing cookies from the file. The
26*6236dae4SAndroid Build Coastguard Workerfile uses the Netscape cookie file format. If you set the filename to a single
27*6236dae4SAndroid Build Coastguard Workerminus, "-", the cookies are written to stdout.
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard WorkerThe file specified with --cookie-jar is only used for output. No cookies are
30*6236dae4SAndroid Build Coastguard Workerread from the file. To read cookies, use the --cookie option. Both options
31*6236dae4SAndroid Build Coastguard Workercan specify the same file.
32*6236dae4SAndroid Build Coastguard Worker
33*6236dae4SAndroid Build Coastguard WorkerThis command line option activates the cookie engine that makes curl record
34*6236dae4SAndroid Build Coastguard Workerand use cookies. The --cookie option also activates it.
35*6236dae4SAndroid Build Coastguard Worker
36*6236dae4SAndroid Build Coastguard WorkerIf the cookie jar cannot be created or written to, the whole curl operation
37*6236dae4SAndroid Build Coastguard Workerdoes not fail or even report an error clearly. Using --verbose gets a warning
38*6236dae4SAndroid Build Coastguard Workerdisplayed, but that is the only visible feedback you get about this possibly
39*6236dae4SAndroid Build Coastguard Workerlethal situation.
40