curl-library
Re: really dumb question I'm sure
Date: Fri, 28 Mar 2003 12:00:15 -0500
Thanks Andrew - of course that makes perfect sense, thanks for your help!
- Josh
Andrew Francis
<locust_at_familyhealth.com.au> To: curl-library_at_lists.sourceforge.net
Sent by: cc:
curl-library-admin_at_lists.sourceforge. Subject: Re: really dumb question I'm sure
net
03/27/2003 10:19 PM
Please respond to curl-library
On Thu, Mar 27, 2003 at 03:46:21PM -0500, josh.m.daynard_at_accenture.com
wrote:
> So my question is: is there anyway in libcurl to just tell it not to
bother
> writing the response anywhere?
Define a custom callback function that does nothing:
extern "C" { // use this if, and only if, you're writing C++
size_t callback_noop(void *p, size_t s, size_t nmemb, void *stream) {
return s * nmemb;
}
} // ditto re: c++
// when about to curl_easy_perform:
curl_easy_setopt(curlHandle, CURLOPT_FILE, NULL);
curl_easy_setopt(curlHandle, CURLOPT_WRITEFUNCTION, curl_noop);
curl_easy_setopt(curlHandle, CURLOPT_HEADERFUNCTION, callback_noop);
This will actually still download all the data though. If you like,
you can get the callback function to cancel the download operation.
You'll get an error returned from curl_easy_perform, but it means
curl won't bother downloading all the data from the web server
size_t callback_noop(void *p, size_t s, size_t nmemb, void *stream) {
return 0; /* abort transfer */
}
-- Andrew Francis Software Developer Family Health Network ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001enReceived on 2003-03-28