cURL / Mailing Lists / curl-users / Single Mail

curl-users

Passing cookies during session

From: Lara Bordick <lbordick_at_interconnect.net>
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:
https://dataserver.somesite.com/file_I_want_to_download.tar.gz

What actually happens is that when I connect to the above URL, I am
redirected to a different server, lets call it
https://validationserver.somesite.com, which handles authentication and then
sets a cookie which dataserver.somesite.com requires to determine that I am
a valid user and then redirects me back to
https://dataserver.somesite.com/file_I_want_to_download.tar.gz. 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
https://validationserver.somesite.com

The second command looks like this:
curl -b cookies --cert my_cert.pem:password -L
https://dataserver.somesite.com/file_I_want_to_download.tar.gz

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 www.cookiesite.com". 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
Email: lbordick_at_northropgrumman.com
Received on 2002-01-17