cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Effective URL different if CURLOPT_NOBODY is set to true

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Wed, 18 Mar 2009 05:12:11 -0500

On Mar 17, 2009, lindsay_at_smithandtinker.com wrote:

> > How about stopping the transfer immediately after the headers
> > have been received?

> Sounds like a good plan - could you tell me how to do that?

If you set up a header callback using CURLOPT_HEADERFUNCTION
that just returns (size*nmemb) for all headers, except for
the case when (size*nmemb)==2, which indicates that you have
received the final "empty" \r\n header. If you return zero
from the callback for this case, it will cause libcurl to
abort the transfer.
In this case a return value of CURLE_WRITE_ERROR from
curl_easy_perform() would indicate "success"

And also, please read the section on top-posting at :
  http://curl.haxx.se/mail/etiquette.html

 - Jeff
Received on 2009-03-18