Fixed deprecated calls
This commit is contained in:
parent
4abe349158
commit
26215025c8
5 changed files with 16 additions and 6 deletions
|
|
@ -27,12 +27,18 @@ namespace SimpleWeb {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace SimpleWeb {
|
namespace SimpleWeb {
|
||||||
#if(defined(ASIO_STANDALONE) && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
|
#if (defined(ASIO_STANDALONE) && ASIO_VERSION >= 103300) || BOOST_ASIO_VERSION >= 103300
|
||||||
|
using const_buffer = asio::const_buffer;
|
||||||
|
#else
|
||||||
|
using const_buffer = asio::const_buffers_1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(ASIO_STANDALONE) && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
|
||||||
using io_context = asio::io_context;
|
using io_context = asio::io_context;
|
||||||
using resolver_results = asio::ip::tcp::resolver::results_type;
|
using resolver_results = asio::ip::tcp::resolver::results_type;
|
||||||
using async_connect_endpoint = asio::ip::tcp::endpoint;
|
using async_connect_endpoint = asio::ip::tcp::endpoint;
|
||||||
|
|
||||||
#if(defined(ASIO_STANDALONE) && ASIO_VERSION >= 101800) || BOOST_ASIO_VERSION >= 101800
|
#if (defined(ASIO_STANDALONE) && ASIO_VERSION >= 101800) || BOOST_ASIO_VERSION >= 101800
|
||||||
using strand = asio::strand<asio::any_io_executor>;
|
using strand = asio::strand<asio::any_io_executor>;
|
||||||
#else
|
#else
|
||||||
using strand = asio::strand<asio::executor>;
|
using strand = asio::strand<asio::executor>;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace SimpleWeb {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Match condition for asio::read_until to match both standard and non-standard HTTP header endings.
|
/// Match condition for asio::read_until to match both standard and non-standard HTTP header endings.
|
||||||
std::pair<asio::buffers_iterator<asio::const_buffers_1>, bool> operator()(asio::buffers_iterator<asio::const_buffers_1> begin, asio::buffers_iterator<asio::const_buffers_1> end) {
|
std::pair<asio::buffers_iterator<const_buffer>, bool> operator()(asio::buffers_iterator<const_buffer> begin, asio::buffers_iterator<const_buffer> end) {
|
||||||
auto it = begin;
|
auto it = begin;
|
||||||
for(; it != end; ++it) {
|
for(; it != end; ++it) {
|
||||||
if(*it == '\n') {
|
if(*it == '\n') {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace SimpleWeb {
|
||||||
Client(const std::string &server_port_path, bool verify_certificate = true, const std::string &certification_file = std::string(),
|
Client(const std::string &server_port_path, bool verify_certificate = true, const std::string &certification_file = std::string(),
|
||||||
const std::string &private_key_file = std::string(), const std::string &verify_file = std::string())
|
const std::string &private_key_file = std::string(), const std::string &verify_file = std::string())
|
||||||
: ClientBase<HTTPS>::ClientBase(server_port_path, 443),
|
: ClientBase<HTTPS>::ClientBase(server_port_path, 443),
|
||||||
#if(defined(ASIO_STANDALONE) && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
|
#if (defined(ASIO_STANDALONE) && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
|
||||||
context(asio::ssl::context::tls_client) {
|
context(asio::ssl::context::tls_client) {
|
||||||
// Disabling TLS 1.0 and 1.1 (see RFC 8996)
|
// Disabling TLS 1.0 and 1.1 (see RFC 8996)
|
||||||
context.set_options(asio::ssl::context::no_tlsv1);
|
context.set_options(asio::ssl::context::no_tlsv1);
|
||||||
|
|
@ -41,7 +41,11 @@ namespace SimpleWeb {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verify_certificate)
|
if(verify_certificate)
|
||||||
|
#if (defined(ASIO_STANDALONE) && ASIO_VERSION >= 103300) || BOOST_ASIO_VERSION >= 103300
|
||||||
|
context.set_verify_callback(asio::ssl::host_name_verification(host));
|
||||||
|
#else
|
||||||
context.set_verify_callback(asio::ssl::rfc2818_verification(host));
|
context.set_verify_callback(asio::ssl::rfc2818_verification(host));
|
||||||
|
#endif
|
||||||
|
|
||||||
if(verify_file.size() > 0)
|
if(verify_file.size() > 0)
|
||||||
context.load_verify_file(verify_file);
|
context.load_verify_file(verify_file);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ namespace SimpleWeb {
|
||||||
b64 = BIO_new(BIO_f_base64());
|
b64 = BIO_new(BIO_f_base64());
|
||||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||||
// TODO: Remove in 2022 or later
|
// TODO: Remove in 2022 or later
|
||||||
#if(defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1000214fL) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2080000fL)
|
#if (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1000214fL) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2080000fL)
|
||||||
bio = BIO_new_mem_buf(const_cast<char *>(&base64[0]), static_cast<int>(base64.size()));
|
bio = BIO_new_mem_buf(const_cast<char *>(&base64[0]), static_cast<int>(base64.size()));
|
||||||
#else
|
#else
|
||||||
bio = BIO_new_mem_buf(&base64[0], static_cast<int>(base64.size()));
|
bio = BIO_new_mem_buf(&base64[0], static_cast<int>(base64.size()));
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace SimpleWeb {
|
||||||
*/
|
*/
|
||||||
Server(const std::string &certification_file, const std::string &private_key_file, const std::string &verify_file = std::string())
|
Server(const std::string &certification_file, const std::string &private_key_file, const std::string &verify_file = std::string())
|
||||||
: ServerBase<HTTPS>::ServerBase(443),
|
: ServerBase<HTTPS>::ServerBase(443),
|
||||||
#if(defined(ASIO_STANDALONE) && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
|
#if (defined(ASIO_STANDALONE) && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
|
||||||
context(asio::ssl::context::tls_server) {
|
context(asio::ssl::context::tls_server) {
|
||||||
// Disabling TLS 1.0 and 1.1 (see RFC 8996)
|
// Disabling TLS 1.0 and 1.1 (see RFC 8996)
|
||||||
context.set_options(asio::ssl::context::no_tlsv1);
|
context.set_options(asio::ssl::context::no_tlsv1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue