cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: WRITEFUNCTION and redirects

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 3 Aug 2003 23:30:48 +0200 (CEST)

On Sat, 2 Aug 2003, Mark Fletcher wrote:

> (message originally sent from the wrong email address)

(So I noticed, but I discarded it when it was caught and had to be dealt with
by an admin.)

> We use CURLOPT_WRITEFUNCTION to grab and save the web pages we fetch.
> According to the docs, that function can be called multiple times, and
> that's fine. But what we're seeing with redirects is that the function is
> first called with data representing the redirect response, and then it's
> called again with the actual page after the redirect.

Which libcurl version?

If you're not using 7.10.6, then please get that, try again and let us know if
you get a different behaviour.

If you're using 7.10.6, then can you please provide an example URL and source
code for this please?

No version of libcurl should do this, but in 7.10.6 I've added code that
"ignores" data contents in the transfer after a Location: header has been
parsed for FOLLOWLOCATION purposes.

> Is there a good way for our write function to know when to ignore data and
> when not to? Ideally, if I have FOLLOWLOCATION set to 1, that the write
> function doesn't get called except for the actual page.

That's the intension. If you get contents meant to be ignored, then you're
experiecing a bug!

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-08-03