C++ 什么样的BSD许可证c/c++;库可用于实现http客户端支持http1.1和ssl

C++ 什么样的BSD许可证c/c++;库可用于实现http客户端支持http1.1和ssl,c++,c,http,ssl,https,C++,C,Http,Ssl,Https,我正在寻找一个c/c++库,它实现或支持HTTP客户机的实现。它还应该支持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,

我正在寻找一个c/c++库,它实现或支持HTTP客户机的实现。它还应该支持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.

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.

Beast支持HTTP/1.0和HTTP/1.1,并与Boost.Asio常规套接字或SSL流一起工作。它是Boost的一部分,包含大量文档,并基于gcc、clang和Visual Studio构建

下面是一个完整的示例程序: 使用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;
}
#包括
#包括
#包括
#包括
int main()
{
//正常boost::asio设置
std::string const host=“boost.org”;
boost::asio::io_服务ios;
boost::asio::ip::tcp::解析器(ios);
boost::asio::ip::tcp::socketsock(ios);
boost::asio::connect(sock,
r、 解析(boost::asio::ip::tcp::resolver::query{host,“http”});
//使用beast发送HTTP请求
beast::http::request_v1 req;
req.method=“GET”;
req.url=“/”;
req.version=11;
REQUE.headers.replace(“主机”,主机+:“+std::to_字符串(sock.remote_端点().port());
请求标题替换(“用户代理”、“Beast”);
beast::http::prepare(req);
beast::http::write(sock,req);
//使用beast接收和打印HTTP响应
野兽:对某人;
beast::http::response_v1 resp;
beast::http::read(sock、sb、resp);

Beast支持HTTP/1.0和HTTP/1.1,并与Boost.Asio常规套接字或SSL流配合使用。它是Boost的一部分,包含大量文档,并基于gcc、clang和Visual Studio构建

下面是一个完整的示例程序: 使用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;
}
#包括
#包括
#包括
#包括
int main()
{
//正常boost::asio设置
std::string const host=“boost.org”;
boost::asio::io_服务ios;
boost::asio::ip::tcp::解析器(ios);
boost::asio::ip::tcp::socketsock(ios);
boost::asio::connect(sock,
r、 解析(boost::asio::ip::tcp::resolver::query{host,“http”});
//使用beast发送HTTP请求
beast::http::request_v1 req;
req.method=“GET”;
req.url=“/”;
req.version=11;
REQUE.headers.replace(“主机”,主机+:“+std::to_字符串(sock.remote_端点().port());
请求标题替换(“用户代理”、“Beast”);
beast::http::prepare(req);
beast::http::write(sock,req);
//使用beast接收和打印HTTP响应
野兽:对某人;
beast::http::response_v1 resp;
beast::http::read(sock、sb、resp);

我想cout libcurl可以。搜索SO也会有帮助。我想libcurl可以。搜索SO也会有帮助。