diff --git a/src/ssl/SSLManager.cpp b/src/ssl/SSLManager.cpp index 052b38a..9784896 100644 --- a/src/ssl/SSLManager.cpp +++ b/src/ssl/SSLManager.cpp @@ -167,11 +167,14 @@ bool SSLManager::unregister_context(const std::string &context) { return true; } -void SSLManager::unregister_web_contexts() { +void SSLManager::unregister_web_contexts(bool default_as_well) { { lock_guard lock{this->context_lock}; decltype(this->contexts) ctxs{this->contexts}; for(auto& [key, _] : ctxs) { + if(key == this->web_ctx_prefix + "default" && !default_as_well) + continue; + (void) _; if(key.find(this->web_ctx_prefix) == 0) { this->contexts.erase(key); diff --git a/src/ssl/SSLManager.h b/src/ssl/SSLManager.h index 1efdf7c..e26ce0d 100644 --- a/src/ssl/SSLManager.h +++ b/src/ssl/SSLManager.h @@ -36,7 +36,7 @@ namespace ts::ssl { bool unregister_context(const std::string& /* key */); bool rename_context(const std::string& /* old key */, const std::string& /* new key */); /* if new already exists it will be dropped */ - void unregister_web_contexts(); + void unregister_web_contexts(bool /* default certificate as well */); std::shared_ptr initializeSSLKey(const std::string &key, const std::string &rsaKey, std::string &error, bool raw = false); std::shared_ptr initializeContext(const std::string& key, std::string& privateKey, std::string& certificate, std::string& error, bool raw = false, const std::shared_ptr& = nullptr);