cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: RE: curl win32 commandline question

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 15 Mar 2001 08:29:04 +0100 (MET)

On Wed, 14 Mar 2001, Kevin P Roth wrote:

> Daniel (or some other knowledgable soul): could someone explain a little
> more fully this portion of the curl --manual (I got this from v7.5.1):
>
> Note that by specifying -b you enable the "cookie awareness" and with -L
> you can make curl follow a location: (which often is used in combination
> with cookies). So that if a site sends cookies and a location, you can
> use a non-existing file to trig the cookie awareness like:
> curl -L -b empty-file www.example.com
>
> Specifically, how is "cookie awareness" different from storing headers in
> one file via -D and reading them via -b?

It is no other difference than the absense of a file. What I call "cookie
awareness" in the manual is simply that curl will start to parse cookies,
store the results, and send cookies to the server on requests that match any
of the kept cookies.

You can do this by running "curl -D file URL1" and then "curl -b file URL2"
in two shots, but if the URL1 returns a Location: to URL2, you can have the
same effect (cookie-wise) with: "curl -L -b fakefile URL1".

I appriciate updates to the docs if anyone can rephrase the existing blurb to
something that is clearer.

> And could you elaborate again on how to make that headers file track the
> headers across several requests?

Storing headers is best used when not doing -L, as curl can't separate
cookies from individual requests in a header dump (when later using -b on the
header dump) that is the result of many requests. It isn't necessarily a bad
thing though.

> I remember trying before using the same file in both -D and -b, and it
> seems that the prior contents of that file were getting overwritten and
> it wasn't really working as intended...

I've intended those two options to be able to use the same file. -b reads the
file initially and -D only writes to the file first when it has data to write
and that happens after the reading is done.

Can you show us an example where this fails?

> I do remember that your suggestion was to manage the contents of my
> headers file externally to curl (such as with my shell script that is
> controlling curl) but I'm wondering if this behavior has changed at all
> since that comment several version ago.

The last two cookie fixes I can find was made for 7.4.2 and before that for
7.3. There's been no change at all to the cookie engine since November 15
last year (apart from memory leak fixes).

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2001-03-15