cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL vs FireFox cookies

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Mon, 28 Sep 2009 14:37:22 -0500

On Mon, Sep 28, 2009 at 11:46 AM, Mambo Knave <mamboknave_at_gmail.com> wrote:

> As novice with all this (and being stuck), I must ask for help.
>
> Enclosed are two files:
>
> etrade_FFox_cookies.png = cookies received by FireFox
>
> etrade_cURL_cookies.txt = cookies received by cURL in the cookie-jar
>
> I assure that both files were produced on two independent and new sessions,
> with FireFox properly purged from previous cookies.
>
> Question is:
>
> Why cURL reports just two cookies while FireFox receive so many more
> (eleven)?
>
> How can I make cURL report all cookies like FireFox does?
>
> As it stands now, with cURL I cannot duplicate/mirror the work of FireFox
> as I need all those cookies.
>
> I will greatly appreciate any help. Thanks in advance.
>

You may need to download more bits of the original page to get more cookies.

For example, I once had to deal with a web page with top, left and main
frames. I only really needed to get the main frame, but the server wouldn't
let me have it without getting the top and left frames first. And I had to
fetch them in that order - top first, then left, then main... Closer
examination of the headers revealed that each piece came with its own cookie
or two and each piece needed the cookies from the previous piece(s).

It's very likely these days that there's a bit of javascript in there
somewhere that does "stuff" with cookies, including making them up
on-the-fly.

Try using something like LiveHTTPHeaders in Firefox to see *when* the extra
cookies show up in the headers. They'll either arrive in "Set-Cookie"
incoming headers along with an image or script file, or they'll magically
appear in outgoing headers without apparently being sent to you. In the
latter case, there's probably some code making them up as it goes along.

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-09-28