Mailing Lists
| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-library Mailing List Archives
Re: API for getting header
From: Joerg Mueller-Tolk <curl_at_mueller-tolk.de>
Date: Thu, 18 Sep 2003 09:15:34 +0200 The following is an excerpt from the curl_easy_setopt() documentation CURLOPT_HEADERFUNCTION
Function pointer that should match the following pro-
totype: size_t function( void *ptr, size_t size,
size_t nmemb, void *stream);. This function gets
called by libcurl as soon as there is received header
data that needs to be written down. The headers are
guaranteed to be written one-by-one and only complete
lines are written. Parsing headers should be easy
enough using this. The size of the data pointed to by
ptr is size multiplied with nmemb. The pointer named
stream will be the one you passed to libcurl with the
CURLOPT_WRITEHEADER option. Return the number of
bytes actually written or return -1 to signal error to
the library (it will cause it to abort the transfer
with a CURLE_WRITE_ERROR return code).
What you have to do is writing a function like:
size_t myPrivateHeaderFunction(void *myParameter, size_t size, size_t nmemb, void *stream) { myStruct *myData = (myStruct*)myParameter; myData->anything... ... } And use it like: myStruct Data; curl_easy_setopt(m_curlHandle, CURLOPT_WRITEHEADER, (void*)&Data); curl_easy_setopt(m_curlHandle, CURLOPT_HEADERFUNCTION, myPrivateHeaderFunction); Hope it helps Joerg M-T ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf Received on 2003-09-18 These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info