cURL / Mailing Lists / curl-users / Single Mail


Passing cookies during session

From: Lara Bordick <>
Date: Thu, 17 Jan 2002 13:21:29 -0600

Using a web browser I can download a particular file that I need at the
following URL by selecting the appropriate client certificate that is
installed in my browser:

What actually happens is that when I connect to the above URL, I am
redirected to a different server, lets call it, which handles authentication and then
sets a cookie which requires to determine that I am
a valid user and then redirects me back to At this
point the browser begins the process of downloading this file.

What I really want to do is to download these files using curl because of
its ability to resume the file transfer where it left off in case of a
broken connection.

I have been able to make this process work using a two step process.

The first command looks like this:
curl -D cookies --cert my_cert.pem:password -L

The second command looks like this:
curl -b cookies --cert my_cert.pem:password -L

Is there a way to do this in one step? The documentation led me to believe
that I should be able to do this using only the second command. In the
tutorial it says "if you want to let curl understand cookies from a page and
follow a location (and thus possibly send back cookies it received), you can
invoke it like:
curl -b nada -L". However when I run the second command
without doing the first I get stuck in a loop between the authentication
server and the dataserver because curl does not appear to be passing the
cookie received from the authentication server to the dataserver.

What is the proper syntax for doing this in one step or is it not possible?

Thank you in advance for shedding some light on my problem.

Lara J. Bordick
Software Engineer
Northrop Grumman IT
Corpus Christi, TX USA
Received on 2002-01-17