From 5cd9d62f52422d946acbc1b5520e998079d79e90 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 20 Jan 2020 10:48:22 +0100 Subject: nginx-util: fix ubus::~iterator() and minor issues * Do not destroy the iterator twice if cur==this (segfault). * Do not add the delimiter clim=='\0' when creating the SSL directives. * Set the right SSL_SESSION_CACHE_ARG for nginx-util get_env. * Remove static from the constexpr that are used only for Line::build. * Concat strings instead of appending them for not using a non-const ref (to remove some warnings of clang-tidy -checks=google-runtime-references) Signed-off-by: Peter Stadler --- net/nginx-util/src/nginx-ssl-util.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'net/nginx-util/src/nginx-ssl-util.cpp') diff --git a/net/nginx-util/src/nginx-ssl-util.cpp b/net/nginx-util/src/nginx-ssl-util.cpp index f4a857397..fcd81a405 100644 --- a/net/nginx-util/src/nginx-ssl-util.cpp +++ b/net/nginx-util/src/nginx-ssl-util.cpp @@ -100,7 +100,7 @@ void del_ssl_directives_from(const std::string & name, bool isdefault); void del_ssl(const std::string & name); -static constexpr auto _begin = _Line{ +constexpr auto _begin = _Line{ [](const std::string & /*param*/, const std::string & begin) -> std::string { return begin; }, @@ -110,7 +110,7 @@ static constexpr auto _begin = _Line{ }; -static constexpr auto _space = _Line{ +constexpr auto _space = _Line{ [](const std::string & /*param*/, const std::string & /*begin*/) -> std::string { return std::string{" "}; }, @@ -121,7 +121,7 @@ static constexpr auto _space = _Line{ }; -static constexpr auto _newline = _Line{ +constexpr auto _newline = _Line{ [](const std::string & /*param*/, const std::string & /*begin*/) -> std::string { return std::string{"\n"}; }, @@ -132,7 +132,7 @@ static constexpr auto _newline = _Line{ }; -static constexpr auto _end = _Line{ +constexpr auto _end = _Line{ [](const std::string & /*param*/, const std::string & /*begin*/) -> std::string { return std::string{";"}; }, @@ -144,7 +144,7 @@ static constexpr auto _end = _Line{ template -static constexpr auto _capture = _Line{ +constexpr auto _capture = _Line{ [](const std::string & param, const std::string & /*begin*/) -> std::string { return '\'' + param + '\''; }, @@ -159,10 +159,14 @@ static constexpr auto _capture = _Line{ template -static constexpr auto _escape = _Line{ +constexpr auto _escape = _Line{ [](const std::string & /*param*/, const std::string & /*begin*/) -> std::string - { return clim + std::string{strptr.data()} + clim; }, + { + return clim=='\0' ? + std::string{strptr.data()} : + clim + std::string{strptr.data()} + clim; + }, [](const std::string & /*param*/, const std::string & /*begin*/) -> std::string @@ -184,17 +188,17 @@ static constexpr auto _escape = _Line{ }; -static constexpr std::string_view _server_name = "server_name"; +constexpr std::string_view _server_name = "server_name"; -static constexpr std::string_view _include = "include"; +constexpr std::string_view _include = "include"; -static constexpr std::string_view _ssl_certificate = "ssl_certificate"; +constexpr std::string_view _ssl_certificate = "ssl_certificate"; -static constexpr std::string_view _ssl_certificate_key = "ssl_certificate_key"; +constexpr std::string_view _ssl_certificate_key = "ssl_certificate_key"; -static constexpr std::string_view _ssl_session_cache = "ssl_session_cache"; +constexpr std::string_view _ssl_session_cache = "ssl_session_cache"; -static constexpr std::string_view _ssl_session_timeout = "ssl_session_timeout"; +constexpr std::string_view _ssl_session_timeout = "ssl_session_timeout"; // For a compile time regex lib, this must be fixed, use one of these options: -- cgit v1.2.3