mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
mod_yparser.cpp: fix compare and writing vars
This commit is contained in:
@@ -101,12 +101,6 @@ bool ySplitString(std::string str, std::string delimiter, std::string& left,
|
||||
left = str; //default if not found
|
||||
right = "";
|
||||
}
|
||||
replace(left, "\r\n", "");
|
||||
replace(left, "\n", "");
|
||||
replace(right, "\r\n", "");
|
||||
replace(right, "\n", "");
|
||||
left = trim(left);
|
||||
right = trim(right);
|
||||
return (pos != std::string::npos);
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
@@ -409,6 +409,8 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
if (ySplitString(ycmd_name, "~", if_left_value, if_right_value)) {
|
||||
if (ySplitString(if_right_value, "~", if_right_value, if_then)) {
|
||||
ySplitString(if_then, "~", if_then, if_else);
|
||||
if_left_value = trim(if_left_value);
|
||||
if_right_value = trim(if_right_value);
|
||||
yresult = (if_left_value == if_right_value) ? if_then
|
||||
: if_else;
|
||||
}
|
||||
@@ -418,6 +420,8 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
if (ySplitString(ycmd_name, "~", if_left_value, if_right_value)) {
|
||||
if (ySplitString(if_right_value, "~", if_right_value, if_then)) {
|
||||
ySplitString(if_then, "~", if_then, if_else);
|
||||
if_left_value = trim(if_left_value);
|
||||
if_right_value = trim(if_right_value);
|
||||
yresult = (if_left_value != if_right_value) ? if_then
|
||||
: if_else;
|
||||
}
|
||||
@@ -505,6 +509,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
} else if (ycmd_type == "var-set") {
|
||||
std::string varname, varvalue;
|
||||
if (ySplitString(ycmd_name, "=", varname, varvalue))
|
||||
varvalue = trim(varvalue);
|
||||
ycgi_vars[varname] = varvalue;
|
||||
} else if (ycmd_type == "global-var-get") {
|
||||
pthread_mutex_lock(&yParser_mutex);
|
||||
@@ -514,6 +519,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
std::string varname, varvalue;
|
||||
if (ySplitString(ycmd_name, "=", varname, varvalue)) {
|
||||
pthread_mutex_lock(&yParser_mutex);
|
||||
varvalue = trim(varvalue);
|
||||
ycgi_global_vars[varname] = varvalue;
|
||||
pthread_mutex_unlock(&yParser_mutex);
|
||||
}
|
||||
|
Reference in New Issue
Block a user