C ++的HTTP客户端库 [英] HTTP Client library for C++
问题描述
我正在尝试编写用于学习C ++ / socket / HTTP的超线程HTTP代理
I'm trying to write milt-threaded HTTP proxy for learning C++/socket/HTTP
我正在寻找Java中可用的HTTP客户端库(如HttpURLConnection)
I'm looking for a HTTP client library like HttpURLConnection available in Java.
我看过一些库,例如C / C ++的libcurl。这些库可以发出http请求,但它们将返回全部内容。我需要一个可以部分读取缓冲区中内容的库,以便能够将其立即发送给请求的客户端,而无需将所有内容存储在内存中。
I looked at some libraries eg, libcurl for C/C++. These libraries can make http request but they will return with the full content. I need a library that can read content partially in a buffer so that I'm able to ship it immediately to requesting client, without storing the entire content in memory.
任何链接/建议受到高度赞赏:)
Any links/suggestions is highly appreciated :)
谢谢!
推荐答案
libcurl文档上有一个示例页面,介绍如何从请求中获取增量下载回调(进入内存缓冲区)作为数据流:
libcurl docs have an example page on how to get incremental download callbacks (into a memory buffer) as data streams in from a request:
http://curl.haxx.se/libcurl/c/getinmemory.html
在您的情况下,您只需将数据缓冲区转发到最初发出请求的客户端即可。
In your case, you would just forward the data buffer on to the client that originally made the request.
这篇关于C ++的HTTP客户端库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!