开发者

Reading all response headers using libCurl in C

开发者 https://www.devze.com 2023-03-23 09:12 出处:网络
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)

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

0

精彩评论

暂无评论...
验证码 换一张
取 消