aboutsummaryrefslogtreecommitdiff
path: root/net/nginx-util/src/nginx-ssl-util.cpp
diff options
context:
space:
mode:
authorPeter Stadler <peter.stadler@student.uibk.ac.at>2020-01-20 10:48:22 +0100
committerPeter Stadler <peter.stadler@student.uibk.ac.at>2020-01-20 15:13:23 +0100
commit5cd9d62f52422d946acbc1b5520e998079d79e90 (patch)
treea794f128075629bef96ab5d8e49646bddc5b4fdb /net/nginx-util/src/nginx-ssl-util.cpp
parent9d8dbdd86ee8fe39469d7c5a25e61ceb4ae18acb (diff)
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 <peter.stadler@student.uibk.ac.at>
Diffstat (limited to 'net/nginx-util/src/nginx-ssl-util.cpp')
-rw-r--r--net/nginx-util/src/nginx-ssl-util.cpp30
1 files changed, 17 insertions, 13 deletions
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<char clim='\0'>
-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<const std::string_view & strptr, char clim='\0'>
-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: