From 1d12e476381f7db9950b117a17974fcad91ecc7d Mon Sep 17 00:00:00 2001 From: Leonid Stryzhevskyi Date: Thu, 21 Oct 2021 00:42:22 +0300 Subject: [PATCH] Update 1.3.0.md --- changelog/1.3.0.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/changelog/1.3.0.md b/changelog/1.3.0.md index 22100852..3162af2a 100644 --- a/changelog/1.3.0.md +++ b/changelog/1.3.0.md @@ -11,10 +11,11 @@ Contents: - [JSON Serializer Escape Flags](#json-serializer-escape-flags) - [ConnectionMonitor](#connectionmonitor) - [Request Data Bundle](#request-data-bundle) +- [ConnectionProviderSwitch](#connectionproviderswitch) - [Response::getBody()](#responsegetbody) - [data::stream::FIFOStream](#datastreamfifostream) - [data::stream::BufferedInputStream](#datastreambufferedinputstream) -- [oatpp::parser::json::mapping::Serializer::Config::alwaysIncludeRequired](#oatppparserjsonmappingSerializerConfigalwaysIncludeRequired) +- [oatpp::parser::json::mapping::Serializer::Config::alwaysIncludeRequired](#oatppparserjsonmappingserializerconfigalwaysincluderequired) ## The New oatpp::String @@ -198,6 +199,40 @@ ENDPOINT("GET", "videos/{videoId}", getVideoById, } ``` +## ConnectionProviderSwitch + +[#483](https://github.com/oatpp/oatpp/issues/483) + +`oatpp::network::ConnectionProviderSwitch` can be used to change connection providers on the go, ex.: when you want to reload an SSL certificate without stopping the server. + +```cpp +/* create server connection provider component */ +/* use ConnectionProviderSwitch instead of a regular ServerConnectionProvider */ +OATPP_CREATE_COMPONENT(std::shared_ptr, serverConnectionProvider)([this] { + /* create SSL provider */ + auto sslProvider = oatpp::libressl::server::ConnectionProvider::createShared(...); + + /* create oatpp::network::ConnectionProviderSwitch*/ + return std::make_shared(sslProvider /* current provider */); +}()); + + +... + +void reloadCert() { + + /* get server connection provider component */ + OATPP_COMPONENT(std::shared_ptr, providerSwitch); + + /* create new SSL provider with new cert */ + auto sslProvider = oatpp::libressl::server::ConnectionProvider::createShared(...); + + /* set new provider */ + providerSwitch->resetProvider(sslProvider); + +} +``` + ## Response::getBody() `oatpp::web::protocol::http::outgoing::Response` has a new method `getBody()` to retreive the body of the response.