cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-users Mailing List Archives

Re: Cookie problem with POST/HTTPS connection

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 10 Mar 2004 16:47:49 +0100 (CET)

On Wed, 10 Mar 2004, Paul Forsyth wrote:

> using your B<=>C analogy, the problem i have is that C expects a cookie to
> have already been set, so when i B makes the POST C doesn't recognise the
> cookie i saved from the last session (internal error), or it fails because
> there is no cookie.
>
> when a browser does this - no curl - it moves the user to the site,
> resulting in a cookie being set. can curl mimick this?

Yes it can. curl can receive cookies, save cookies, load cookies and decide
what cookies to send back on subsequent requests based on what cookies it
knows.

When you visit this site using a browser for the first time in your life, I
suspect the browser gets a cookie? Probably when you login or something.

Do that with curl too, and save the cookie (in a "cookiejar" to use the curl
term).

When you then POST using the browser, the correct cookie is sent and you can
post.

To do this with curl you make sure you use the same cookiejar with the cookie
from the previous fetch.

You need to mimic everything (or at least large parts of what) you do with the
browser, not just the last step.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
Received on 2004-03-10

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET