cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Persistent connections and cookies

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 28 Feb 2002 23:40:50 +0100 (MET)

On Thu, 28 Feb 2002, Clay Loveless wrote:

> Question about persistent connections & cookies with curl ...
>
> If I'm using a cookiejar to store cookies, and need to make the following
> requests ...
>
> 1. www.foo.com/a.html
> 2. www.foo.com/b.html
> 3. www.foo.com/c.html
>
> If I pass a cookiefile in with all of these requests on one command, will
> cookies set by "a.html" be sent to the request for "b.html" and "c.html"?

Yes they will. In fact, if you put them on the same command line, you won't
have to care if the connection becomes persistant or not, the cookie stuff
will work correctly no matter what.

> I'm assuming they would NOT be, since it's the same connection. But --
> since it's a different request to the same host, I'm keeping my fingers
> crossed.

Exactly. curl collects and stores all cookies internally when they're
received (if that is enabled) and on all requests it checks the internal
cookie storage to see if there are any cookies present that should be sent
off.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-02-28