summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/http/listener.cc5
-rw-r--r--src/lib/http/listener.h3
-rw-r--r--src/lib/http/listener_impl.cc5
-rw-r--r--src/lib/http/listener_impl.h3
-rw-r--r--src/lib/http/tests/http_server_test.h1
5 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/http/listener.cc b/src/lib/http/listener.cc
index 18f81f529c..9c05e99689 100644
--- a/src/lib/http/listener.cc
+++ b/src/lib/http/listener.cc
@@ -42,6 +42,11 @@ HttpListener::getLocalPort() const {
return (impl_->getEndpoint().getPort());
}
+const TlsContextPtr&
+HttpListener::getTlsContext() const {
+ return (impl_->getTlsContext());
+}
+
int
HttpListener::getNative() const {
return (impl_->getNative());
diff --git a/src/lib/http/listener.h b/src/lib/http/listener.h
index b842d7f18d..9f35e62642 100644
--- a/src/lib/http/listener.h
+++ b/src/lib/http/listener.h
@@ -115,6 +115,9 @@ public:
/// @brief Returns local port on which server is listening.
uint16_t getLocalPort() const;
+ /// @brief Returns reference to the current TLS context.
+ const asiolink::TlsContextPtr& getTlsContext() const;
+
/// @brief file descriptor of the underlying acceptor socket.
int getNative() const;
diff --git a/src/lib/http/listener_impl.cc b/src/lib/http/listener_impl.cc
index 70535ef7e5..85fd74ee3d 100644
--- a/src/lib/http/listener_impl.cc
+++ b/src/lib/http/listener_impl.cc
@@ -70,6 +70,11 @@ HttpListenerImpl::getEndpoint() const {
return (*endpoint_);
}
+const TlsContextPtr&
+HttpListenerImpl::getTlsContext() const {
+ return (tls_context_);
+}
+
int
HttpListenerImpl::getNative() const {
return (acceptor_ ? acceptor_->getNative() : -1);
diff --git a/src/lib/http/listener_impl.h b/src/lib/http/listener_impl.h
index 73f70dc507..f36a1330b8 100644
--- a/src/lib/http/listener_impl.h
+++ b/src/lib/http/listener_impl.h
@@ -60,6 +60,9 @@ public:
/// @brief Returns reference to the current listener endpoint.
const asiolink::TCPEndpoint& getEndpoint() const;
+ /// @brief Returns reference to the current TLS context.
+ const asiolink::TlsContextPtr& getTlsContext() const;
+
/// @brief file descriptor of the underlying acceptor socket.
int getNative() const;
diff --git a/src/lib/http/tests/http_server_test.h b/src/lib/http/tests/http_server_test.h
index 48c0671400..bd59d61ce3 100644
--- a/src/lib/http/tests/http_server_test.h
+++ b/src/lib/http/tests/http_server_test.h
@@ -392,6 +392,7 @@ public:
ASSERT_NO_THROW(listener.start());
ASSERT_EQ(SERVER_ADDRESS, listener.getLocalAddress().toText());
ASSERT_EQ(SERVER_PORT, listener.getLocalPort());
+ ASSERT_EQ(server_context_, listener.getTlsContext());
ASSERT_NO_THROW(startRequest(request));
ASSERT_NO_THROW(runIOService());
ASSERT_EQ(1, clients_.size());