From dfaa858a63c4886226cbe850f4ff89ae06c42d9a Mon Sep 17 00:00:00 2001 From: "enrico.detoma" Date: Tue, 6 Aug 2019 08:00:24 +0200 Subject: [PATCH 1/6] Fix for boost 1.70 (get_io_service() was deprecated and was removed) --- boost/network/protocol/http/client/connection/async_base.hpp | 2 +- .../network/protocol/http/client/connection/async_normal.hpp | 4 ++-- .../http/client/connection/connection_delegate_factory.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/boost/network/protocol/http/client/connection/async_base.hpp b/boost/network/protocol/http/client/connection/async_base.hpp index ec1737828..2c1ab423b 100644 --- a/boost/network/protocol/http/client/connection/async_base.hpp +++ b/boost/network/protocol/http/client/connection/async_base.hpp @@ -59,7 +59,7 @@ struct async_connection_base { async_connection; typedef typename delegate_factory::type delegate_factory_type; auto delegate = delegate_factory_type::new_connection_delegate( - resolver.get_io_service(), https, always_verify_peer, + (boost::asio::io_context &)resolver.get_executor().context(), https, always_verify_peer, certificate_filename, verify_path, certificate_file, private_key_file, ciphers, sni_hostname, ssl_options); auto temp = std::make_shared( diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index adae8edf0..1423ed417 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -154,12 +154,12 @@ struct http_async_connection connection_delegate_ptr delegate) : timeout_(timeout), remove_chunk_markers_(remove_chunk_markers), - timer_(resolver.get_io_service()), + timer_((boost::asio::io_context &)resolver.get_executor().context()), is_timedout_(false), follow_redirect_(follow_redirect), resolver_(resolver), resolve_(std::move(resolve)), - request_strand_(resolver.get_io_service()), + request_strand_((boost::asio::io_context &)resolver.get_executor().context()), delegate_(std::move(delegate)) {} // This is the main entry point for the connection/request pipeline. diff --git a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp index fa419e1e6..e18874c51 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp @@ -34,7 +34,7 @@ struct connection_delegate_factory { // This is the factory method that actually returns the delegate instance. // TODO(dberris): Support passing in proxy settings when crafting connections. static connection_delegate_ptr new_connection_delegate( - boost::asio::io_service& service, bool https, bool always_verify_peer, + boost::asio::io_context& service, bool https, bool always_verify_peer, optional certificate_filename, optional verify_path, optional certificate_file, optional private_key_file, optional ciphers, From cf11364b28927a80cdadae7c5384185ccdff83eb Mon Sep 17 00:00:00 2001 From: "enrico.detoma" Date: Tue, 6 Aug 2019 08:03:05 +0200 Subject: [PATCH 2/6] Fix for boost 1.70 (get_io_service() was deprecated and was removed) --- .../network/protocol/http/client/connection/sync_normal.hpp | 4 ++-- boost/network/protocol/http/client/connection/sync_ssl.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index 1f3775474..d84a42110 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -49,10 +49,10 @@ struct http_sync_connection int timeout) : connection_base(), timeout_(timeout), - timer_(resolver.get_io_service()), + timer_((boost::asio::io_context &)resolver.get_executor().context()), resolver_(resolver), resolve_(std::move(resolve)), - socket_(resolver.get_io_service()) {} + socket_((boost::asio::io_context &)resolver.get_executor().context()) {} void init_socket(string_type const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); diff --git a/boost/network/protocol/http/client/connection/sync_ssl.hpp b/boost/network/protocol/http/client/connection/sync_ssl.hpp index 349449512..12ea39c1d 100644 --- a/boost/network/protocol/http/client/connection/sync_ssl.hpp +++ b/boost/network/protocol/http/client/connection/sync_ssl.hpp @@ -60,11 +60,11 @@ struct https_sync_connection long ssl_options = 0) : connection_base(), timeout_(timeout), - timer_(resolver.get_io_service()), + timer_((boost::asio::io_context &)resolver.get_executor().context()), resolver_(resolver), resolve_(std::move(resolve)), - context_(resolver.get_io_service(), boost::asio::ssl::context::sslv23_client), - socket_(resolver.get_io_service(), context_) { + context_((boost::asio::io_context &)resolver.get_executor().context(), boost::asio::ssl::context::sslv23_client), + socket_((boost::asio::io_context &)resolver.get_executor().context(), context_) { if (ciphers) { ::SSL_CTX_set_cipher_list(context_.native_handle(), ciphers->c_str()); } From 5351fc6e2cf26a205e9a0eb029d96f689bc43b78 Mon Sep 17 00:00:00 2001 From: "enrico.detoma" Date: Thu, 8 Aug 2019 13:23:31 +0200 Subject: [PATCH 3/6] Fix for boost 1.70 (get_io_service() was deprecated and was removed) --- .../protocol/http/client/connection/async_base.hpp | 10 +++++++++- .../http/client/connection/async_normal.hpp | 12 ++++++++++-- .../connection/connection_delegate_factory.hpp | 7 ++++++- .../http/client/connection/sync_normal.hpp | 12 ++++++++++-- .../protocol/http/client/connection/sync_ssl.hpp | 14 +++++++++++--- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/boost/network/protocol/http/client/connection/async_base.hpp b/boost/network/protocol/http/client/connection/async_base.hpp index 2c1ab423b..6a2025aea 100644 --- a/boost/network/protocol/http/client/connection/async_base.hpp +++ b/boost/network/protocol/http/client/connection/async_base.hpp @@ -17,6 +17,14 @@ #include #include +#ifndef GET_IO_SERVICE +#if BOOST_VERSION >= 107000 +#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#else +#define GET_IO_SERVICE(s) ((s).get_io_service()) +#endif +#endif + namespace boost { namespace network { namespace http { @@ -59,7 +67,7 @@ struct async_connection_base { async_connection; typedef typename delegate_factory::type delegate_factory_type; auto delegate = delegate_factory_type::new_connection_delegate( - (boost::asio::io_context &)resolver.get_executor().context(), https, always_verify_peer, + GET_IO_SERVICE(resolver), https, always_verify_peer, certificate_filename, verify_path, certificate_file, private_key_file, ciphers, sni_hostname, ssl_options); auto temp = std::make_shared( diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index 1423ed417..f90caed00 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -33,6 +33,14 @@ #include #include +#ifndef GET_IO_SERVICE +#if BOOST_VERSION >= 107000 +#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#else +#define GET_IO_SERVICE(s) ((s).get_io_service()) +#endif +#endif + namespace boost { namespace network { namespace http { @@ -154,12 +162,12 @@ struct http_async_connection connection_delegate_ptr delegate) : timeout_(timeout), remove_chunk_markers_(remove_chunk_markers), - timer_((boost::asio::io_context &)resolver.get_executor().context()), + timer_(GET_IO_SERVICE(resolver)), is_timedout_(false), follow_redirect_(follow_redirect), resolver_(resolver), resolve_(std::move(resolve)), - request_strand_((boost::asio::io_context &)resolver.get_executor().context()), + request_strand_(GET_IO_SERVICE(resolver)), delegate_(std::move(delegate)) {} // This is the main entry point for the connection/request pipeline. diff --git a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp index e18874c51..c887f3c55 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp @@ -34,7 +34,12 @@ struct connection_delegate_factory { // This is the factory method that actually returns the delegate instance. // TODO(dberris): Support passing in proxy settings when crafting connections. static connection_delegate_ptr new_connection_delegate( - boost::asio::io_context& service, bool https, bool always_verify_peer, +#if BOOST_VERSION >= 107000 + boost::asio::io_context& service, +#else + boost::asio::io_service& service, +#endif + bool https, bool always_verify_peer, optional certificate_filename, optional verify_path, optional certificate_file, optional private_key_file, optional ciphers, diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index d84a42110..5bc75513b 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -17,6 +17,14 @@ #include #include +#ifndef GET_IO_SERVICE +#if BOOST_VERSION >= 107000 +#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#else +#define GET_IO_SERVICE(s) ((s).get_io_service()) +#endif +#endif + namespace boost { namespace network { namespace http { @@ -49,10 +57,10 @@ struct http_sync_connection int timeout) : connection_base(), timeout_(timeout), - timer_((boost::asio::io_context &)resolver.get_executor().context()), + timer_(GET_IO_SERVICE(resolver)), resolver_(resolver), resolve_(std::move(resolve)), - socket_((boost::asio::io_context &)resolver.get_executor().context()) {} + socket_(GET_IO_SERVICE(resolver)) {} void init_socket(string_type const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); diff --git a/boost/network/protocol/http/client/connection/sync_ssl.hpp b/boost/network/protocol/http/client/connection/sync_ssl.hpp index 12ea39c1d..8547fd24c 100644 --- a/boost/network/protocol/http/client/connection/sync_ssl.hpp +++ b/boost/network/protocol/http/client/connection/sync_ssl.hpp @@ -17,6 +17,14 @@ #include #include +#ifndef GET_IO_SERVICE +#if BOOST_VERSION >= 107000 +#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#else +#define GET_IO_SERVICE(s) ((s).get_io_service()) +#endif +#endif + namespace boost { namespace network { namespace http { @@ -60,11 +68,11 @@ struct https_sync_connection long ssl_options = 0) : connection_base(), timeout_(timeout), - timer_((boost::asio::io_context &)resolver.get_executor().context()), + timer_(GET_IO_SERVICE(resolver)), resolver_(resolver), resolve_(std::move(resolve)), - context_((boost::asio::io_context &)resolver.get_executor().context(), boost::asio::ssl::context::sslv23_client), - socket_((boost::asio::io_context &)resolver.get_executor().context(), context_) { + context_(GET_IO_SERVICE(resolver), boost::asio::ssl::context::sslv23_client), + socket_(GET_IO_SERVICE(resolver), context_) { if (ciphers) { ::SSL_CTX_set_cipher_list(context_.native_handle(), ciphers->c_str()); } From 9aaa54606b744841f878485044a8d3e0dbb24984 Mon Sep 17 00:00:00 2001 From: "enrico.detoma" Date: Thu, 8 Aug 2019 17:11:58 +0200 Subject: [PATCH 4/6] Fix for boost 1.70 (get_io_service() was deprecated and was removed) --- boost/network/compat.hpp | 17 +++++++++++++++++ .../http/client/connection/async_base.hpp | 11 ++--------- .../http/client/connection/async_normal.hpp | 13 +++---------- .../http/client/connection/sync_normal.hpp | 13 +++---------- .../http/client/connection/sync_ssl.hpp | 15 ++++----------- 5 files changed, 29 insertions(+), 40 deletions(-) create mode 100644 boost/network/compat.hpp diff --git a/boost/network/compat.hpp b/boost/network/compat.hpp new file mode 100644 index 000000000..f65356199 --- /dev/null +++ b/boost/network/compat.hpp @@ -0,0 +1,17 @@ +#ifndef BOOST_NETWORK_COMPAT_HPP__ +#define BOOST_NETWORK_COMPAT_HPP__ + +// Copyright 2010 (C) Dean Michael Berris +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// This macro is used to solve a compatibility problem with Boost >= 1.70 +// where the deprecated method get_io_service() was removed +#if BOOST_VERSION >= 107000 +#define CPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#else +#define CPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((s).get_io_service()) +#endif + +#endif // BOOST_NETWORK_COMPAT_HPP__ diff --git a/boost/network/protocol/http/client/connection/async_base.hpp b/boost/network/protocol/http/client/connection/async_base.hpp index 6a2025aea..455e7940f 100644 --- a/boost/network/protocol/http/client/connection/async_base.hpp +++ b/boost/network/protocol/http/client/connection/async_base.hpp @@ -16,14 +16,7 @@ #include #include #include - -#ifndef GET_IO_SERVICE -#if BOOST_VERSION >= 107000 -#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) -#else -#define GET_IO_SERVICE(s) ((s).get_io_service()) -#endif -#endif +#include namespace boost { namespace network { @@ -67,7 +60,7 @@ struct async_connection_base { async_connection; typedef typename delegate_factory::type delegate_factory_type; auto delegate = delegate_factory_type::new_connection_delegate( - GET_IO_SERVICE(resolver), https, always_verify_peer, + CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver), https, always_verify_peer, certificate_filename, verify_path, certificate_file, private_key_file, ciphers, sni_hostname, ssl_options); auto temp = std::make_shared( diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index f90caed00..107c8bf0e 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -32,14 +32,7 @@ #include #include #include - -#ifndef GET_IO_SERVICE -#if BOOST_VERSION >= 107000 -#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) -#else -#define GET_IO_SERVICE(s) ((s).get_io_service()) -#endif -#endif +#include namespace boost { namespace network { @@ -162,12 +155,12 @@ struct http_async_connection connection_delegate_ptr delegate) : timeout_(timeout), remove_chunk_markers_(remove_chunk_markers), - timer_(GET_IO_SERVICE(resolver)), + timer_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)), is_timedout_(false), follow_redirect_(follow_redirect), resolver_(resolver), resolve_(std::move(resolve)), - request_strand_(GET_IO_SERVICE(resolver)), + request_strand_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)), delegate_(std::move(delegate)) {} // This is the main entry point for the connection/request pipeline. diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index 5bc75513b..ec55e0e10 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -16,14 +16,7 @@ #include #include #include - -#ifndef GET_IO_SERVICE -#if BOOST_VERSION >= 107000 -#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) -#else -#define GET_IO_SERVICE(s) ((s).get_io_service()) -#endif -#endif +#include namespace boost { namespace network { @@ -57,10 +50,10 @@ struct http_sync_connection int timeout) : connection_base(), timeout_(timeout), - timer_(GET_IO_SERVICE(resolver)), + timer_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)), resolver_(resolver), resolve_(std::move(resolve)), - socket_(GET_IO_SERVICE(resolver)) {} + socket_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)) {} void init_socket(string_type const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); diff --git a/boost/network/protocol/http/client/connection/sync_ssl.hpp b/boost/network/protocol/http/client/connection/sync_ssl.hpp index 8547fd24c..e25da99df 100644 --- a/boost/network/protocol/http/client/connection/sync_ssl.hpp +++ b/boost/network/protocol/http/client/connection/sync_ssl.hpp @@ -16,14 +16,7 @@ #include #include #include - -#ifndef GET_IO_SERVICE -#if BOOST_VERSION >= 107000 -#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) -#else -#define GET_IO_SERVICE(s) ((s).get_io_service()) -#endif -#endif +#include namespace boost { namespace network { @@ -68,11 +61,11 @@ struct https_sync_connection long ssl_options = 0) : connection_base(), timeout_(timeout), - timer_(GET_IO_SERVICE(resolver)), + timer_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)), resolver_(resolver), resolve_(std::move(resolve)), - context_(GET_IO_SERVICE(resolver), boost::asio::ssl::context::sslv23_client), - socket_(GET_IO_SERVICE(resolver), context_) { + context_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver), boost::asio::ssl::context::sslv23_client), + socket_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver), context_) { if (ciphers) { ::SSL_CTX_set_cipher_list(context_.native_handle(), ciphers->c_str()); } From 77adf2dac0823a7c4a8578035391a95a2e22890c Mon Sep 17 00:00:00 2001 From: "enrico.detoma" Date: Fri, 9 Aug 2019 08:41:16 +0200 Subject: [PATCH 5/6] Fix for boost 1.70 (get_io_service() was deprecated and was removed) --- boost/network/compat.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boost/network/compat.hpp b/boost/network/compat.hpp index f65356199..a94831acc 100644 --- a/boost/network/compat.hpp +++ b/boost/network/compat.hpp @@ -1,13 +1,13 @@ #ifndef BOOST_NETWORK_COMPAT_HPP__ #define BOOST_NETWORK_COMPAT_HPP__ -// Copyright 2010 (C) Dean Michael Berris +// Copyright 2019 (C) Enrico Detoma // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // This macro is used to solve a compatibility problem with Boost >= 1.70 -// where the deprecated method get_io_service() was removed +// where the deprecated method get_io_service() was removed. #if BOOST_VERSION >= 107000 #define CPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) #else From 227f55246bcf13a3ba9457cadfa391b44ec64da8 Mon Sep 17 00:00:00 2001 From: "enrico.detoma" Date: Fri, 9 Aug 2019 10:44:26 +0200 Subject: [PATCH 6/6] Fix for boost 1.70 (get_io_service() was deprecated and was removed) --- boost/network/compat.hpp | 4 +++- .../http/client/connection/connection_delegate_factory.hpp | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/boost/network/compat.hpp b/boost/network/compat.hpp index a94831acc..a22b4a2a7 100644 --- a/boost/network/compat.hpp +++ b/boost/network/compat.hpp @@ -6,12 +6,14 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// This macro is used to solve a compatibility problem with Boost >= 1.70 +// These macros are used to solve a compatibility problem with Boost >= 1.70 // where the deprecated method get_io_service() was removed. #if BOOST_VERSION >= 107000 #define CPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#define CPP_NETLIB_ASIO_IO_SERVICE_CONTEXT boost::asio::io_context #else #define CPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((s).get_io_service()) +#define CPP_NETLIB_ASIO_IO_SERVICE_CONTEXT boost::asio::io_service #endif #endif // BOOST_NETWORK_COMPAT_HPP__ diff --git a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp index c887f3c55..8b86465c4 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp @@ -34,11 +34,7 @@ struct connection_delegate_factory { // This is the factory method that actually returns the delegate instance. // TODO(dberris): Support passing in proxy settings when crafting connections. static connection_delegate_ptr new_connection_delegate( -#if BOOST_VERSION >= 107000 - boost::asio::io_context& service, -#else - boost::asio::io_service& service, -#endif + CPP_NETLIB_ASIO_IO_SERVICE_CONTEXT& service, bool https, bool always_verify_peer, optional certificate_filename, optional verify_path, optional certificate_file,