diff --git a/include/pistache/endpoint.h b/include/pistache/endpoint.h index 2c19f819b..f1701faac 100644 --- a/include/pistache/endpoint.h +++ b/include/pistache/endpoint.h @@ -125,6 +125,8 @@ class Endpoint { void useSSLAuth(std::string ca_file, std::string ca_path = "", int (*cb)(int, void *) = NULL); + bool setSessionIdContext(const std::string &s_id_ctx); + bool isBound() const { return listener.isBound(); } Port getPort() const { return listener.getPort(); } diff --git a/include/pistache/listener.h b/include/pistache/listener.h index 3a2f72dad..f52cebc24 100644 --- a/include/pistache/listener.h +++ b/include/pistache/listener.h @@ -76,6 +76,7 @@ class Listener { bool use_compression); void setupSSLAuth(const std::string &ca_file, const std::string &ca_path, int (*cb)(int, void *)); + bool setSessionIdContext(const std::string &s_id_ctx); private: Address addr_; diff --git a/src/server/endpoint.cc b/src/server/endpoint.cc index 8dc6b8776..4908d07dd 100644 --- a/src/server/endpoint.cc +++ b/src/server/endpoint.cc @@ -105,6 +105,10 @@ Endpoint::requestLoad(const Tcp::Listener::Load &old) { return listener.requestLoad(old); } +bool Endpoint::setSessionIdContext(const std::string &s_id_ctx) { + return listener.setSessionIdContext(s_id_ctx); +} + Endpoint::Options Endpoint::options() { return Options(); } } // namespace Http diff --git a/src/server/listener.cc b/src/server/listener.cc index 462a98a88..ea16a55a1 100644 --- a/src/server/listener.cc +++ b/src/server/listener.cc @@ -444,6 +444,13 @@ void Listener::setupSSLAuth(const std::string &ca_file, ); } +bool Listener::setSessionIdContext(const std::string &s_id_ctx) +{ + return SSL_CTX_set_session_id_context(GetSSLContext(ssl_ctx_), + (const unsigned char*)s_id_ctx.c_str(), + (unsigned int)s_id_ctx.length()) == 1; +} + void Listener::setupSSL(const std::string &cert_path, const std::string &key_path, bool use_compression) { SSL_load_error_strings();