mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
Adjust SSL context generation for Server:
The creation of self-signed certificates slows down the command line client when launched repeatedly during unit test. * Contexts are no longer generated for the command line client * A port with no secure protocols generates an empty context
This commit is contained in:
@@ -427,6 +427,29 @@ adminRole (HTTP::Port const& port,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
ServerHandler::Setup::makeContexts()
|
||||
{
|
||||
for(auto& p : ports)
|
||||
{
|
||||
if (p.secure())
|
||||
{
|
||||
if (p.ssl_key.empty() && p.ssl_cert.empty() &&
|
||||
p.ssl_chain.empty())
|
||||
p.context = make_SSLContext();
|
||||
else
|
||||
p.context = make_SSLContextAuthed (
|
||||
p.ssl_key, p.ssl_cert, p.ssl_chain);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.context = std::make_shared<
|
||||
boost::asio::ssl::context>(
|
||||
boost::asio::ssl::context::sslv23);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Parse a comma-delimited list of values.
|
||||
@@ -616,13 +639,6 @@ to_Port(ParsedPort const& parsed, std::ostream& log)
|
||||
p.ssl_cert = parsed.ssl_cert;
|
||||
p.ssl_chain = parsed.ssl_chain;
|
||||
|
||||
if (p.ssl_key.empty() && p.ssl_cert.empty() &&
|
||||
p.ssl_chain.empty())
|
||||
p.context = make_SSLContext();
|
||||
else
|
||||
p.context = make_SSLContextAuthed (
|
||||
p.ssl_key, p.ssl_cert, p.ssl_chain);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user