curl-users
Re: curl_easy_perform blocks when trying to read a response Header
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 6 Nov 2008 17:57:18 +0100 (CET)
Date: Thu, 6 Nov 2008 17:57:18 +0100 (CET)
On Thu, 6 Nov 2008, Ambarish Mitra wrote:
I seriously recommend using the curl-library list for libcurl stuff...
> char *hdrdata;
>
> size_t WriteHeaderCallback(void *ptr, size_t size, size_t nmemb, void *data)
> {
> size_t realsize = size * nmemb;
> hdrdata = (char *) malloc (realsize);
> memcpy(hdrdata, ptr, realsize);
> return realsize;
> }
The callback gets called once for very header you receive so you leak memory
and overwrite the previous header in this code for all subsequent headers
after the first..
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2008-11-06