cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: SSL + Cookies

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Sun, 23 Mar 2008 22:19:17 -0500

On Sun, Mar 23, 2008 at 9:14 PM, insaini <insaini_at_rogers.com> wrote:

> The cookies are not received by curl at all and do not get stored in the
> cookie jar. I have tried using preg_match to extract the cookies directly
> from the response and there is nothing except for the JSESSIONID even
> though
> in Live Http Headers for firefox it says there are ..
>
> The curl version is 7.18 (I finally got it installed and compiled with
> php
> 5.2.5)
>
> It may be easier for you to try it yourself actually..
>
> This is the link
>
>
> https://est-oee.canadapost-postescanada.ca/shipping/estShipping.jsp?locale=e
> n_CA&formId=110<https://est-oee.canadapost-postescanada.ca/shipping/estShipping.jsp?locale=en_CA&formId=110>
>
> it will redirect you to the login page (although Im not entirely sure that
> it is an actual redirect) ..
>
> using Live HTTP headers you'll see exactly what I mean

The first page gives back a page with a META refresh tag that has a big
url. Fetching *that* link returns a page containing this little bit of
javascript:

        sTestCookie = "CPC_TEST_COOKIE";
        oDate = new Date();
        oDate.setFullYear(oDate.getFullYear() + 10);
        sDate = oDate.toGMTString();
        sCookieListUPC = sTestCookie + "=TEST; expires=" + sDate + ";
path=/";
        document.cookie = sCookieListUPC;
        if(!document.cookie)
                location = "browser_error.htm";

So, the web browser is generating the CPC_TEST_COOKIE on-the-fly. Curl
doesn't even attempt to execute the javascript. You'll need to examine the
page content and deal with any script-generated cookies yourself.

Ralph Mitchell
Received on 2008-03-24