From: Francis Dupont Date: Fri, 19 Mar 2021 18:47:43 +0000 (+0100) Subject: [#1661] Addressed some comments X-Git-Tag: Kea-1.9.6~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6fe8105d4e3ed94a4a83badf3b880a600d761da;p=thirdparty%2Fkea.git [#1661] Addressed some comments --- diff --git a/src/lib/http/client.cc b/src/lib/http/client.cc index 0613d262f9..61c0851850 100644 --- a/src/lib/http/client.cc +++ b/src/lib/http/client.cc @@ -108,12 +108,12 @@ public: /// @brief Constructor. /// /// @param io_service IO service to be used for the connection. - /// @param context TLS context to be used for the connection. + /// @param tls_context TLS context to be used for the connection. /// @param conn_pool Back pointer to the connection pool to which this /// connection belongs. /// @param url URL associated with this connection. explicit Connection(IOService& io_service, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const ConnectionPoolPtr& conn_pool, const Url& url); @@ -469,7 +469,7 @@ public: /// in progress for the given URL. Otherwise, the request is queued. /// /// @param url Destination where the request should be sent. - /// @param context TLS context to be used for the connection. + /// @param tls_context TLS context to be used for the connection. /// @param request Pointer to the request to be sent to the server. /// @param response Pointer to the object into which the response should be /// stored. @@ -484,7 +484,7 @@ public: /// @param close_callback Pointer to the user callback to be invoked when the /// client closes the connection to the server. void queueRequest(const Url& url, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpRequestPtr& request, const HttpResponsePtr& response, const long request_timeout, @@ -494,12 +494,12 @@ public: const HttpClient::CloseHandler& close_callback) { if (MultiThreadingMgr::instance().getMode()) { std::lock_guard lk(mutex_); - return (queueRequestInternal(url, context, request, response, + return (queueRequestInternal(url, tls_context, request, response, request_timeout, request_callback, connect_callback, handshake_callback, close_callback)); } else { - return (queueRequestInternal(url, context, request, response, + return (queueRequestInternal(url, tls_context, request, response, request_timeout, request_callback, connect_callback, handshake_callback, close_callback)); @@ -585,7 +585,7 @@ private: /// This method should be called in a thread safe context. /// /// @param url Destination where the request should be sent. - /// @param context TLS context to be used for the connection. + /// @param tls_context TLS context to be used for the connection. /// @param request Pointer to the request to be sent to the server. /// @param response Pointer to the object into which the response should be /// stored. @@ -600,7 +600,7 @@ private: /// @param close_callback Pointer to the user callback to be invoked when the /// client closes the connection to the server. void queueRequestInternal(const Url& url, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpRequestPtr& request, const HttpResponsePtr& response, const long request_timeout, @@ -630,7 +630,7 @@ private: // There is no connection with this destination yet. Let's create // it and start the transaction. ConnectionPtr conn(new Connection(io_service_, - context, + tls_context, shared_from_this(), url)); conn->doTransaction(request, response, request_timeout, @@ -786,18 +786,18 @@ private: }; Connection::Connection(IOService& io_service, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const ConnectionPoolPtr& conn_pool, const Url& url) : conn_pool_(conn_pool), url_(url), tcp_socket_(), tls_socket_(), timer_(io_service), current_request_(), current_response_(), parser_(), current_callback_(), buf_(), input_buf_(), current_transid_(0), close_callback_(), started_(false) { - if (!context) { + if (!tls_context) { tcp_socket_.reset(new asiolink::TCPSocket(io_service)); } else { tls_socket_.reset(new asiolink::TLSSocket(io_service, - context)); + tls_context)); } } @@ -1426,7 +1426,7 @@ HttpClient::HttpClient(IOService& io_service) void HttpClient::asyncSendRequest(const Url& url, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpRequestPtr& request, const HttpResponsePtr& response, const HttpClient::RequestHandler& request_callback, @@ -1438,7 +1438,7 @@ HttpClient::asyncSendRequest(const Url& url, isc_throw(HttpClientError, "invalid URL specified for the HTTP client"); } - if ((url.getScheme() == Url::Scheme::HTTPS) && !context) { + if ((url.getScheme() == Url::Scheme::HTTPS) && !tls_context) { isc_throw(HttpClientError, "HTTPS URL scheme but no TLS context"); } @@ -1454,7 +1454,7 @@ HttpClient::asyncSendRequest(const Url& url, isc_throw(HttpClientError, "callback for HTTP transaction must not be null"); } - impl_->conn_pool_->queueRequest(url, context, request, response, + impl_->conn_pool_->queueRequest(url, tls_context, request, response, request_timeout.value_, request_callback, connect_callback, handshake_callback, close_callback); diff --git a/src/lib/http/client.h b/src/lib/http/client.h index bb4463c4f3..20ec30947e 100644 --- a/src/lib/http/client.h +++ b/src/lib/http/client.h @@ -176,7 +176,7 @@ public: /// callback can be used to recognize this condition. /// /// @param url URL where the request should be send. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param request Pointer to the object holding a request. /// @param response Pointer to the object where response should be stored. /// @param request_callback Pointer to the user callback function invoked @@ -191,7 +191,7 @@ public: /// /// @throw HttpClientError If invalid arguments were provided. void asyncSendRequest(const Url& url, - const asiolink::TlsContextPtr& context, + const asiolink::TlsContextPtr& tls_context, const HttpRequestPtr& request, const HttpResponsePtr& response, const RequestHandler& request_callback, diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc index 322016570c..854c31e432 100644 --- a/src/lib/http/connection.cc +++ b/src/lib/http/connection.cc @@ -64,7 +64,7 @@ SocketCallback::operator()(boost::system::error_code ec, size_t length) { HttpConnection::HttpConnection(asiolink::IOService& io_service, const HttpAcceptorPtr& acceptor, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, HttpConnectionPool& connection_pool, const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, @@ -73,7 +73,7 @@ HttpConnection::HttpConnection(asiolink::IOService& io_service, const long idle_timeout) : request_timer_(io_service), request_timeout_(request_timeout), - context_(context), + tls_context_(tls_context), idle_timeout_(idle_timeout), tcp_socket_(), tls_socket_(), @@ -82,11 +82,11 @@ HttpConnection::HttpConnection(asiolink::IOService& io_service, response_creator_(response_creator), acceptor_callback_(acceptor_callback), handshake_callback_(handshake_callback) { - if (!context) { + if (!tls_context) { tcp_socket_.reset(new asiolink::TCPSocket(io_service)); } else { tls_socket_.reset(new asiolink::TLSSocket(io_service, - context)); + tls_context)); } } @@ -110,7 +110,7 @@ HttpConnection::shutdown() { // Create instance of the callback to close the socket. SocketCallback cb(std::bind(&HttpConnection::shutdownCallback, shared_from_this(), - ph::_1)); // error + ph::_1)); // error_code tls_socket_->shutdown(cb); return; } @@ -311,7 +311,7 @@ HttpConnection::acceptorCallback(const boost::system::error_code& ec) { acceptor_callback_(ec); if (!ec) { - if (!context_) { + if (!tls_context_) { LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_DETAIL, HTTP_REQUEST_RECEIVE_START) .arg(getRemoteEndpointAddressAsText()) diff --git a/src/lib/http/connection.h b/src/lib/http/connection.h index 7ac30a0f2d..6cbdb20ae8 100644 --- a/src/lib/http/connection.h +++ b/src/lib/http/connection.h @@ -232,7 +232,7 @@ public: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -244,7 +244,7 @@ public: /// closed by the server. HttpConnection(asiolink::IOService& io_service, const HttpAcceptorPtr& acceptor, - const asiolink::TlsContextPtr& context, + const asiolink::TlsContextPtr& tls_context, HttpConnectionPool& connection_pool, const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, @@ -396,7 +396,7 @@ protected: long request_timeout_; /// @brief TLS context. - asiolink::TlsContextPtr context_; + asiolink::TlsContextPtr tls_context_; /// @brief Timeout after which the persistent HTTP connection is shut /// down by the server. diff --git a/src/lib/http/connection_pool.h b/src/lib/http/connection_pool.h index 25d0189375..fcadd5c445 100644 --- a/src/lib/http/connection_pool.h +++ b/src/lib/http/connection_pool.h @@ -38,7 +38,7 @@ public: /// @param connection Pointer to the new connection. void start(const HttpConnectionPtr& connection); - /// @brief Removes a connection them from the pool and shutdown it. + /// @brief Removes a connection from the pool and shutdown it. /// /// @note if the TLS connection stalls e.g. the peer does not try I/O /// on it the connection has to be explicitly stopped. diff --git a/src/lib/http/listener.cc b/src/lib/http/listener.cc index 63455f88f5..2e6d2e1c62 100644 --- a/src/lib/http/listener.cc +++ b/src/lib/http/listener.cc @@ -18,12 +18,12 @@ namespace http { HttpListener::HttpListener(IOService& io_service, const asiolink::IOAddress& server_address, const unsigned short server_port, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const HttpListener::RequestTimeout& request_timeout, const HttpListener::IdleTimeout& idle_timeout) : impl_(new HttpListenerImpl(io_service, server_address, server_port, - context, creator_factory, + tls_context, creator_factory, request_timeout.value_, idle_timeout.value_)) { } diff --git a/src/lib/http/listener.h b/src/lib/http/listener.h index 51cb9eef90..8965f29f1c 100644 --- a/src/lib/http/listener.h +++ b/src/lib/http/listener.h @@ -85,7 +85,7 @@ public: /// @param io_service IO service to be used by the listener. /// @param server_address Address on which the HTTP service should run. /// @param server_port Port number on which the HTTP service should run. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param creator_factory Pointer to the caller-defined /// @ref HttpResponseCreatorFactory derivation which should be used to /// create @ref HttpResponseCreator instances. @@ -99,7 +99,7 @@ public: HttpListener(asiolink::IOService& io_service, const asiolink::IOAddress& server_address, const unsigned short server_port, - const asiolink::TlsContextPtr& context, + const asiolink::TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const RequestTimeout& request_timeout, const IdleTimeout& idle_timeout); diff --git a/src/lib/http/listener_impl.cc b/src/lib/http/listener_impl.cc index 012c2747d7..7c28bd79ab 100644 --- a/src/lib/http/listener_impl.cc +++ b/src/lib/http/listener_impl.cc @@ -19,16 +19,16 @@ namespace http { HttpListenerImpl::HttpListenerImpl(IOService& io_service, const asiolink::IOAddress& server_address, const unsigned short server_port, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const long request_timeout, const long idle_timeout) - : io_service_(io_service), context_(context), acceptor_(), + : io_service_(io_service), tls_context_(tls_context), acceptor_(), endpoint_(), connections_(), creator_factory_(creator_factory), request_timeout_(request_timeout), idle_timeout_(idle_timeout) { // Create the TCP or TLS acceptor. - if (!context) { + if (!tls_context) { acceptor_.reset(new HttpAcceptor(io_service)); } else { acceptor_.reset(new HttpsAcceptor(io_service)); @@ -125,7 +125,7 @@ HttpListenerImpl::createConnection(const HttpResponseCreatorPtr& response_creato const HttpAcceptorCallback& acceptor_callback, const HttpAcceptorCallback& handshake_callback) { HttpConnectionPtr - conn(new HttpConnection(io_service_, acceptor_, context_, + conn(new HttpConnection(io_service_, acceptor_, tls_context_, connections_, response_creator, acceptor_callback, handshake_callback, request_timeout_, idle_timeout_)); diff --git a/src/lib/http/listener_impl.h b/src/lib/http/listener_impl.h index 33eb258af1..8edd403d61 100644 --- a/src/lib/http/listener_impl.h +++ b/src/lib/http/listener_impl.h @@ -33,7 +33,7 @@ public: /// @param io_service IO service to be used by the listener. /// @param server_address Address on which the HTTP service should run. /// @param server_port Port number on which the HTTP service should run. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param creator_factory Pointer to the caller-defined /// @ref HttpResponseCreatorFactory derivation which should be used to /// create @ref HttpResponseCreator instances. @@ -47,7 +47,7 @@ public: HttpListenerImpl(asiolink::IOService& io_service, const asiolink::IOAddress& server_address, const unsigned short server_port, - const asiolink::TlsContextPtr& context, + const asiolink::TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const long request_timeout, const long idle_timeout); @@ -113,7 +113,7 @@ protected: asiolink::IOService& io_service_; /// @brief TLS context. - asiolink::TlsContextPtr context_; + asiolink::TlsContextPtr tls_context_; /// @brief Acceptor instance. HttpAcceptorPtr acceptor_; diff --git a/src/lib/http/tests/server_client_unittests.cc b/src/lib/http/tests/server_client_unittests.cc index a454ddb824..c859258a2c 100644 --- a/src/lib/http/tests/server_client_unittests.cc +++ b/src/lib/http/tests/server_client_unittests.cc @@ -211,12 +211,12 @@ public: HttpListenerImplCustom(IOService& io_service, const IOAddress& server_address, const unsigned short server_port, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const long request_timeout, const long idle_timeout) : HttpListenerImpl(io_service, server_address, server_port, - context, creator_factory, request_timeout, + tls_context, creator_factory, request_timeout, idle_timeout) { } @@ -230,7 +230,7 @@ protected: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -247,7 +247,7 @@ protected: const HttpAcceptorCallback& handshake_callback) { HttpConnectionPtr conn(new HttpConnectionType(io_service_, acceptor_, - context_, connections_, + tls_context_, connections_, response_creator, acceptor_callback, handshake_callback, request_timeout_, idle_timeout_)); @@ -271,7 +271,7 @@ public: /// @param io_service IO service to be used by the listener. /// @param server_address Address on which the HTTP service should run. /// @param server_port Port number on which the HTTP service should run. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param creator_factory Pointer to the caller-defined /// @ref HttpResponseCreatorFactory derivation which should be used to /// create @ref HttpResponseCreator instances. @@ -285,18 +285,18 @@ public: HttpListenerCustom(IOService& io_service, const IOAddress& server_address, const unsigned short server_port, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const HttpListener::RequestTimeout& request_timeout, const HttpListener::IdleTimeout& idle_timeout) : HttpListener(io_service, server_address, server_port, - context, creator_factory, + tls_context, creator_factory, request_timeout, idle_timeout) { // Replace the default implementation with the customized version // using the custom derivation of the HttpConnection. impl_.reset(new HttpListenerImplCustom (io_service, server_address, server_port, - context, creator_factory, request_timeout.value_, + tls_context, creator_factory, request_timeout.value_, idle_timeout.value_)); } }; @@ -311,7 +311,7 @@ public: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -323,14 +323,14 @@ public: /// closed by the server. HttpConnectionLongWriteBuffer(IOService& io_service, const HttpAcceptorPtr& acceptor, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, HttpConnectionPool& connection_pool, const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, const HttpAcceptorCallback& handshake_callback, const long request_timeout, const long idle_timeout) - : HttpConnection(io_service, acceptor, context, connection_pool, + : HttpConnection(io_service, acceptor, tls_context, connection_pool, response_creator, acceptor_callback, handshake_callback, request_timeout, idle_timeout) { @@ -361,7 +361,7 @@ public: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param context TLS tls_context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -373,14 +373,14 @@ public: /// closed by the server. HttpConnectionTransactionChange(IOService& io_service, const HttpAcceptorPtr& acceptor, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, HttpConnectionPool& connection_pool, const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, const HttpAcceptorCallback& handshake_callback, const long request_timeout, const long idle_timeout) - : HttpConnection(io_service, acceptor, context, connection_pool, + : HttpConnection(io_service, acceptor, tls_context, connection_pool, response_creator, acceptor_callback, handshake_callback, request_timeout, idle_timeout) { diff --git a/src/lib/http/tests/tls_client_unittests.cc b/src/lib/http/tests/tls_client_unittests.cc index 204a8f2090..ed5cbb89e6 100644 --- a/src/lib/http/tests/tls_client_unittests.cc +++ b/src/lib/http/tests/tls_client_unittests.cc @@ -51,6 +51,8 @@ using namespace isc::http::test; using namespace isc::util; namespace ph = std::placeholders; +/// @todo: put the common part of client and server tests in its own file(s). + namespace { /// @brief IP address to which HTTP service is bound. diff --git a/src/lib/http/tests/tls_server_unittests.cc b/src/lib/http/tests/tls_server_unittests.cc index 50c99c3433..44ecf081fb 100644 --- a/src/lib/http/tests/tls_server_unittests.cc +++ b/src/lib/http/tests/tls_server_unittests.cc @@ -42,6 +42,8 @@ using namespace isc::http::test; using namespace isc::util; namespace ph = std::placeholders; +/// @todo: put the common part of client and server tests in its own file(s). + namespace { /// @brief IP address to which HTTP service is bound. @@ -213,12 +215,12 @@ public: HttpListenerImplCustom(IOService& io_service, const IOAddress& server_address, const unsigned short server_port, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const long request_timeout, const long idle_timeout) : HttpListenerImpl(io_service, server_address, server_port, - context, creator_factory, request_timeout, + tls_context, creator_factory, request_timeout, idle_timeout) { } @@ -232,7 +234,7 @@ protected: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -247,11 +249,11 @@ protected: virtual HttpConnectionPtr createConnection(const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, const HttpAcceptorCallback& handshake_callback) { - TlsContextPtr context; - configClient(context); + TlsContextPtr tls_context; + configClient(tls_context); HttpConnectionPtr conn(new HttpConnectionType(io_service_, acceptor_, - context_, connections_, + tls_context_, connections_, response_creator, acceptor_callback, handshake_callback, request_timeout_, idle_timeout_)); @@ -275,7 +277,7 @@ public: /// @param io_service IO service to be used by the listener. /// @param server_address Address on which the HTTP service should run. /// @param server_port Port number on which the HTTP service should run. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param creator_factory Pointer to the caller-defined /// @ref HttpResponseCreatorFactory derivation which should be used to /// create @ref HttpResponseCreator instances. @@ -289,18 +291,18 @@ public: HttpListenerCustom(IOService& io_service, const IOAddress& server_address, const unsigned short server_port, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, const HttpResponseCreatorFactoryPtr& creator_factory, const HttpListener::RequestTimeout& request_timeout, const HttpListener::IdleTimeout& idle_timeout) : HttpListener(io_service, server_address, server_port, - context, creator_factory, + tls_context, creator_factory, request_timeout, idle_timeout) { // Replace the default implementation with the customized version // using the custom derivation of the HttpConnection. impl_.reset(new HttpListenerImplCustom (io_service, server_address, server_port, - context, creator_factory, request_timeout.value_, + tls_context, creator_factory, request_timeout.value_, idle_timeout.value_)); } }; @@ -315,7 +317,7 @@ public: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -327,14 +329,14 @@ public: /// closed by the server. HttpConnectionLongWriteBuffer(IOService& io_service, const HttpAcceptorPtr& acceptor, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, HttpConnectionPool& connection_pool, const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, const HttpAcceptorCallback& handshake_callback, const long request_timeout, const long idle_timeout) - : HttpConnection(io_service, acceptor, context, connection_pool, + : HttpConnection(io_service, acceptor, tls_context, connection_pool, response_creator, acceptor_callback, handshake_callback, request_timeout, idle_timeout) { @@ -365,7 +367,7 @@ public: /// @param io_service IO service to be used by the connection. /// @param acceptor Pointer to the TCP acceptor object used to listen for /// new HTTP connections. - /// @param context TLS context. + /// @param tls_context TLS context. /// @param connection_pool Connection pool in which this connection is /// stored. /// @param response_creator Pointer to the response creator object used to @@ -377,14 +379,14 @@ public: /// closed by the server. HttpConnectionTransactionChange(IOService& io_service, const HttpAcceptorPtr& acceptor, - const TlsContextPtr& context, + const TlsContextPtr& tls_context, HttpConnectionPool& connection_pool, const HttpResponseCreatorPtr& response_creator, const HttpAcceptorCallback& acceptor_callback, const HttpAcceptorCallback& handshake_callback, const long request_timeout, const long idle_timeout) - : HttpConnection(io_service, acceptor, context, connection_pool, + : HttpConnection(io_service, acceptor, tls_context, connection_pool, response_creator, acceptor_callback, handshake_callback, request_timeout, idle_timeout) { @@ -421,10 +423,10 @@ public: /// connect() to connect to the server. /// /// @param io_service IO service to be stopped on error. - /// @param context TLS context. - TestHttpClient(IOService& io_service, TlsContextPtr context) + /// @param tls_context TLS context. + TestHttpClient(IOService& io_service, TlsContextPtr tls_context) : io_service_(io_service.get_io_service()), - stream_(io_service_, context->getContext()), + stream_(io_service_, tls_context->getContext()), buf_(), response_() { }