include $(TOPDIR)/rules.mk
PKG_NAME:=nginx-util
-PKG_VERSION:=1.1
-PKG_RELEASE:=2
+PKG_VERSION:=1.2
+PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
PROVIDES:=nginx-ssl-util
endef
-define Package/nginx-ssl-util-nopcre
- $(Package/nginx-ssl-util/default)
- TITLE+= (using <regex>)
-endef
-
define Package/nginx-ssl-util
$(Package/nginx-ssl-util/default)
TITLE+= (using PCRE)
DEPENDS+= +libpcre
endef
+define Package/nginx-ssl-util-nopcre
+ $(Package/nginx-ssl-util/default)
+ TITLE+= (using <regex>)
+endef
+
define Package/nginx-util/description
Utility that builds dynamically LAN listen directives for Nginx.
endef
[](const std::string & /*param*/, const std::string & /*begin*/)
-> std::string
- { return R"([{;](\s*))"; }
+ { return R"([{;](?:\s*#[^\n]*(?=\n))*(\s*))"; }
};
[](const std::string & /*param*/, const std::string & /*begin*/)
-> std::string
- { return std::string{R"(\s*;)"}; }
+ { return std::string{R"(\s*;(?:[\t ]*#[^\n]*)?)"}; }
};
rgx::regex_search(pos, conf.end(), match, LINE.RGX());
pos += match.position(0) + match.length(0))
{
- const std::string_view value = match.str(match.size() - 1);
+ const std::string value = match.str(match.size() - 1);
if (value==val || value=="'"+val+"'" || value=='"'+val+'"') {
return "";
rgx::regex_search(pos, conf.end(), match, rgx);
pos += match.position(0) + match.length(0))
{
- const std::string_view value = match.str(match.size() - 1);
-
- auto skip = 1; // one for delimiter!
+ const std::string value = match.str(match.size() - 1);
+ auto len = match.position(1);
if (compare && value!=val && value!="'"+val+"'" && value!='"'+val+'"') {
- skip = match.length(0);
+ len = match.position(0) + match.length(0);
}
- ret.append(pos, pos + match.position(0) + skip);
+ ret.append(pos, pos + len);
}
ret.append(pos, conf.end());
get_if_missed(conf, NGX_INCLUDE_LAN_LISTEN, "", indent);
if (adds.length() > 0) {
- pos += match.position(0) + 1;
+ pos += match.position(1);
conf = std::string(const_conf.begin(), pos) + adds
+ std::string(pos, const_conf.end());
auto line = const_conf.substr(prev, curr-prev+1);
- line = delete_if(line, CRON_CMD.RGX(), std::string{name}, true);
-
- if (line.substr(0,line.size()-1)==CRON_INTERVAL) { changed = true; }
- else { conf += line; }
+ if (line==delete_if(line,CRON_CMD.RGX(),std::string{name},true)) {
+ conf += line;
+ } else { changed = true; }
prev = curr + 1;
}