cURL / Mailing Lists / curl-library / Single Mail


RE: CURLOPT_WRITEFUNCTION callback not called when If-Modified-Since not obeyed

From: Daniel Stenberg <>
Date: Wed, 18 May 2011 22:45:21 +0200 (CEST)

On Mon, 16 May 2011, Steve Liao wrote:

>> See, it *hasn't been modified* since the given time so libcurl is obviously
>> doing the right thing for you! The HTTP server doesn't seem to acknowledge
>> the request properly though so libcurl had to do the check itself.

> Libcurl 7.17.1 called the callback registered against CURLOPT_WRITEFUNCTION.
> However, Libcurl 7.21.6 no longer does.

I'm pretty sure that was a bug in 7.17.1 then. This "extra" logic to check the
date even for 200 replies have been in place for a very long time.

> So the application using 7.21.6 needs to check if the Last-Modified in the
> 200 OK is the same as the If-Modified-Since in the GET request. If that's
> the case, the applilcation shall handle this as if a 304 were returned and
> must not expect the writefunction callback to be invoked. Would you please
> confirm my understanding?

Yes, that seems to be the exact case. From an application's point of view it
would of course be helpful if libcurl could better tell it when it did in fact
act like this...

One thing we should verify carefully is that libcurl treats a follow-up
request on that same host/connection properly. I don't see that it forcibly
closes the connection when it returns - I don't see how it can re-use this
connection successfully.

List admin:
Received on 2011-05-18