]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1661] Addressed some comments
authorFrancis Dupont <fdupont@isc.org>
Fri, 19 Mar 2021 18:47:43 +0000 (19:47 +0100)
committerFrancis Dupont <fdupont@isc.org>
Wed, 24 Mar 2021 08:10:30 +0000 (09:10 +0100)
12 files changed:
src/lib/http/client.cc
src/lib/http/client.h
src/lib/http/connection.cc
src/lib/http/connection.h
src/lib/http/connection_pool.h
src/lib/http/listener.cc
src/lib/http/listener.h
src/lib/http/listener_impl.cc
src/lib/http/listener_impl.h
src/lib/http/tests/server_client_unittests.cc
src/lib/http/tests/tls_client_unittests.cc
src/lib/http/tests/tls_server_unittests.cc

index 0613d262f9d892bd10651981ea35a791de028d03..61c085185066db2dafc6edec1fc332d8651e3e70 100644 (file)
@@ -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<std::mutex> 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<SocketCallback>(io_service));
     } else {
         tls_socket_.reset(new asiolink::TLSSocket<SocketCallback>(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);
index bb4463c4f3b4b2d266f7067317090b9fbaa33605..20ec30947e39b7aea75576a3496cd177d543b86c 100644 (file)
@@ -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,
index 322016570c8cbe8e5936a223155fcf9c4c55bf8f..854c31e4327c2ec7201bdbf50850a55714b22447 100644 (file)
@@ -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<SocketCallback>(io_service));
     } else {
         tls_socket_.reset(new asiolink::TLSSocket<SocketCallback>(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())
index 7ac30a0f2d2f813abfd474197b2a291ec0f49f14..6cbdb20ae8999adb1eb4baa71a053c5524da03b1 100644 (file)
@@ -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.
index 25d0189375a2de0e957229ac011a5657c9f33215..fcadd5c445f11bc712c73211ee66e9414bc2e87b 100644 (file)
@@ -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.
index 63455f88f5f9bcc01b2d348fbbecbe189c29f7fa..2e6d2e1c62b4c7d6e9eb3f8c306ef1c23e32c3ee 100644 (file)
@@ -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_)) {
 }
index 51cb9eef90a97488c7c679913bb7bb06bc224894..8965f29f1c04e36a2e77b95ab0aeebbd5f3778b6 100644 (file)
@@ -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);
index 012c2747d78da0aef4b15fdff79d9748fc2c81e6..7c28bd79ab4bc6cb48cce85f45ac0b353965f0cc 100644 (file)
@@ -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_));
index 33eb258af1cce9d359a26989bb8ff19c47650223..8edd403d61a4a1dcfa18db2b9dc7a61328d2f866 100644 (file)
@@ -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_;
index a454ddb8242ca079ee29f6245d8985546c2b1e79..c859258a2c3b2c443113aba3307bc7b6ae24e1e6 100644 (file)
@@ -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<HttpConnectionType>
                     (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) {
index 204a8f2090e2ce76c6e00d4ba5557e7523804b0c..ed5cbb89e61fe8b6c557b33336655e4e6784e204 100644 (file)
@@ -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.
index 50c99c34338ab6dd92f56417af1c61ef51f3a599..44ecf081fbaafa28716b49fed78b648712196eae 100644 (file)
@@ -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<HttpConnectionType>
                     (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_() {
     }