读下使用的libcurl的响应头 [英] Reading all response headers using libCurl in C
问题描述
我如何从下使用libcurl的响应读取响应头?
How do I read response headers from a response using libCurl in C?
手册页这样说:
size_t function( void *ptr, size_t size, size_t nmemb, void *stream)
什么是在流在这里?我从流或从PTR读头?
What is the stream here? Do I read headers from stream or from ptr?
我目前正在读从PTR code和传递一个结构的数据流。
I am currently trying to read code from ptr and passing a struct for stream.
和唯一的响应报头看到的是HTTP / 1。 0确定。闲来无事,我是pretty确保响应有更多的标题
And the only response header is see is http/1. 0 ok. Nothing else and I am pretty sure the response has more headers
推荐答案
最后一个参数是不是甲流,这是一个void *您如果用户数据使用。到读出的数据中* ptr的,并且该功能将一次接收到的每个首标被调用。
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.
(最后一个参数通常用来指回至下用C风格的API,可以通过一个静态方法++对象的实例...)
(The last parameter is often used to point back to an C++ object instance through a static method using the C-style API...)
下面的一个例子:
http://permalink.gmane.org/gmane.comp。 web.curl.library / 28803
这篇关于读下使用的libcurl的响应头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!