Fixed deprecated calls

This commit is contained in:
eidheim 2025-04-03 10:58:13 +02:00
commit 26215025c8
5 changed files with 16 additions and 6 deletions

View file

@ -27,12 +27,18 @@ namespace SimpleWeb {
#endif
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 resolver_results = asio::ip::tcp::resolver::results_type;
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>;
#else
using strand = asio::strand<asio::executor>;

View file

@ -17,7 +17,7 @@ namespace SimpleWeb {
public:
/// 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;
for(; it != end; ++it) {
if(*it == '\n') {

View file

@ -27,7 +27,7 @@ namespace SimpleWeb {
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())
: 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) {
// Disabling TLS 1.0 and 1.1 (see RFC 8996)
context.set_options(asio::ssl::context::no_tlsv1);
@ -41,7 +41,11 @@ namespace SimpleWeb {
}
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));
#endif
if(verify_file.size() > 0)
context.load_verify_file(verify_file);

View file

@ -70,7 +70,7 @@ namespace SimpleWeb {
b64 = BIO_new(BIO_f_base64());
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
// 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()));
#else
bio = BIO_new_mem_buf(&base64[0], static_cast<int>(base64.size()));

View file

@ -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())
: 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) {
// Disabling TLS 1.0 and 1.1 (see RFC 8996)
context.set_options(asio::ssl::context::no_tlsv1);