cURL / Mailing Lists / curl-users / Single Mail


RE: cURL usage dilemma

From: Roth, Kevin P. <>
Date: Tue, 30 Apr 2002 10:33:44 -0400

A small correction, for what it's worth...

The -b and -c options don't need to be used together. They both "turn on" the cookie engine. -b and -D are the two normally used in combination. Here's the skinny:

 -D dumps headers (including cookies) into a text file
 -b reads cookies from a text (such as the output from -D)
    and "enables" the cookie parsing engine

 -c reads and *writes* cookies from a netscape-style
    cookies file, and "enables" the cookie parsing engine

So, if all URLs needing the cookies can be issued as part of the same call to curl.exe, and if you don't feel the need to save cookies in any sort of external file, then use "-b empty.txt" (substituting any non-existant filename for "empty.txt", such as NUL or /dev/null).

If you just want to track cookies, the easiest way (both to understand and to type) is to use "-c cookiefile.txt". This will save all cookies (both persistant and non-persistant if I recall correctly) into your specified filename. To wipe out non-persistant cookies when you're done with a "session", simply delete the file.

[Daniel -- did we ever create a way to place persistant and non-persistant cookies into two different files?]

Finally, if you want to track all headers, including cookies, combining -b and -D as needed may be the best option for you.


-----Original Message-----
From: Ralph Mitchell []
Sent: Tuesday, April 30, 2002 1:07 AM
To: David Withnall
Subject: Re: cURL usage dilemma

Using "-b empty.txt" just starts the cookie engine and, if there is anything in the file, sends those cookies. To save cookies between invocations of Curl, you need to use "-c empty.txt" as well.

i.e. curl -b cookies.txt -c cookies.txt .......

Ralph Mitchell
Received on 2002-04-30