Reading all response headers using libCurl in C
How do I read response headers from a response using libCurl in C?
The MAN page says this:
size_t function( void *ptr, size_t size, size_t nmemb, void *stream)
What is the stream here? Do I read headers from stream or from ptr?
I am currently trying to read code from ptr and passing a struct for stream.
And the only response header is see is http/1开发者_运维技巧. 0 ok. Nothing else and I am pretty sure the response has more headers
The last parameter isn't a stream, it's a void* to your userdata if used. The data to read is in *ptr, and this function will be called once for each header received.
(The last parameter is often used to point back to an C++ object instance through a static method using the C-style API...)
One example here:
http://permalink.gmane.org/gmane.comp.web.curl.library/28803
精彩评论