BSD许可证c/c++库可以用来实现http客户端支持http1.1和ssl
what BSD license c/c++ library can use to implement http client support http1.1 and ssl
我正在寻找一个实现或启用HTTP客户端实现的c/c++库。它还应该支持http1.1和ssl。你会提出什么建议?
提前感谢您抽出时间。
libcurl
支持HTTP1.1、TLS,并且似乎使用类似于BSD:的许可证
All rights reserved.
.
Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
.
Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.
以下是一个完整的示例程序:使用HTTP从网站请求根页面并打印响应:
#include <beast/http.hpp>
#include <boost/asio.hpp>
#include <iostream>
#include <string>
int main()
{
// Normal boost::asio setup
std::string const host = "boost.org";
boost::asio::io_service ios;
boost::asio::ip::tcp::resolver r(ios);
boost::asio::ip::tcp::socket sock(ios);
boost::asio::connect(sock,
r.resolve(boost::asio::ip::tcp::resolver::query{host, "http"}));
// Send HTTP request using beast
beast::http::request_v1<beast::http::empty_body> req;
req.method = "GET";
req.url = "/";
req.version = 11;
req.headers.replace("Host", host + ":" + std::to_string(sock.remote_endpoint().port()));
req.headers.replace("User-Agent", "Beast");
beast::http::prepare(req);
beast::http::write(sock, req);
// Receive and print HTTP response using beast
beast::streambuf sb;
beast::http::response_v1<beast::http::streambuf_body> resp;
beast::http::read(sock, sb, resp);
std::cout << resp;
}
相关文章:
- 使用 c++ 的 http 客户端的默认方法
- 在客户端和备忘录中获取 HTTP 命令
- 在 MySQL 中运行 HTTP 服务器以从客户端接收数据
- Waveshare 电子纸 ESP32 板上的 HTTP 客户端管理问题
- 节点.js HTTP 无法通过套接字接收来自C++客户端的请求
- C++HTTP客户端在GET请求后挂起read()调用
- 为什么 JsonCpp http 客户端在 201 响应代码上失败?
- boost :: Beast Sync http客户端的超时
- 异步WT :: HTTP ::客户端响应和请求匹配
- 使用带有SSL(HTTPS)的Boost-Beast(ASIO)HTTP客户端
- 当发送多个同时请求时,单线程异步系统中Beast Boost异步HTTP客户端的行为
- 基于BOOST :: ASIO-慢慢http客户端 - (转移块)
- 如何对 HTTP 客户端进行测试
- 简单的C 异步HTTP客户端
- 是否可以更改HTTP客户端超时期限(cpp-netlib)
- 用于C++的Google API客户端库与用于发送HTTP请求的libcurl
- HTTP 请求使用 Google API 客户端库进行C++
- Wt::Http::客户端始终以 throw_exception<boost::bad_weak_ptr>() 结尾
- Websocketpp简单HTTP客户端
- 从Poco http客户端获取对字符串的响应