Skip to content

Commit

Permalink
Merge pull request #3306 from airween/v3/time_mon_fix
Browse files Browse the repository at this point in the history
fix: align TIME_MON variable's behavior
  • Loading branch information
airween authored Nov 24, 2024
2 parents fd45641 + daf550e commit d9101a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/variables/time_mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void TimeMon::evaluate(Transaction *transaction,
struct tm timeinfo;
localtime_r(&timer, &timeinfo);

transaction->m_variableTimeMin.assign(std::to_string(timeinfo.tm_mon));
transaction->m_variableTimeMin.assign(std::to_string(timeinfo.tm_mon + 1));

l->push_back(new VariableValue(&m_retName,
&transaction->m_variableTimeMin));
Expand Down
3 changes: 2 additions & 1 deletion test/test-cases/regression/variable-TIME_MON.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
]
},
"expected":{
"debug_log":"Target value: \"([0-9]+)\" \\(Variable: TIME_MON\\)"
"http_code": 200,
"debug_log":"Target value: \"([1-9]|1[012])\" \\(Variable: TIME_MON\\)"
},
"rules":[
"SecRuleEngine On",
Expand Down

0 comments on commit d9101a4

Please sign in to comment.