cURL / Mailing Lists / curl-library / Single Mail

curl-library

Availability of header info prior to writefunction callback

From: Britton, David L. (ELS-DAY) <David.Britton_at_elsevier.com>
Date: Fri, 29 Jul 2011 12:54:37 +0000

I would like to be able to use the Content-Length response header to preallocate a large amount of memory for use by the write function. Through some trickery, I was able to get access to the active easy handle in the callback function and tried to call

curl_easy_getinfo(_handleCurl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &_contentLength) from within the WRITEFUNCTION callback itself.

It 'works' but it looks like the info in the handle isn't set prior to completion of the download, which is too late.

Hoping I'm missing something trivial as allocating large amounts of memory 16k at a time is slowing things down significantly.

Thanks!

Dave

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-07-29