curl-library
Re: Bug report: cookies and redirection
Date: Thu, 10 Apr 2008 11:03:47 +0200 (CEST)
On Wed, 9 Apr 2008, Ben Combee wrote:
> Here's one problem I saw with libcurl 7.17.1 (hadn't retried with 7.18.1 but
> didn't see anything in change notes that seemed like it would affect this).
> I used both CURLOPT_COOKIE and CURLOPT_FOLLOWLOCATION for a handle. In
> watching the HTTP traffic, the cookie I'd set for the original URL also got
> sent to the redirected URL.
This is actually by design and not a bug. CURLOPT_COOKIE adds the cookie
header in the outgoing request, and with CURLOPT_FOLLOWLOCATION enabled there
may be more than one request performed and they all get that cookie header.
(I've now clarified this a bit in the docs.)
If you'd rather want a cookie added to the "engine" and thus sent only to the
proper host etc you probably should rather add the cookie with
CURLOPT_COOKIELIST.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-04-10