Skip to content

Commit ea7cacf

Browse files
martinhsvzimmerle
authored andcommitted
Additional adjustment to Cookie header parsing
1 parent 6395fe0 commit ea7cacf

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v3.0.4 - YYYY-MMM-DD (to be released)
22
-------------------------------------
33

4+
- Additional adjustment to Cookie header parsing
5+
[@martinhsv]
46
- Restore chained rule part H logging to be more like 2.9 behaviour
57
[Issue #2196 - @martinhsv]
68
- Small fixes in log messages to help debugging the file upload

src/transaction.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,9 @@ int Transaction::addRequestHeader(const std::string& key,
552552

553553
std::vector<std::string> cookies = utils::string::ssplit(value, ';');
554554

555-
// Get rid of any optional whitespace after the cookie-string
556-
// (i.e. after the end of the final cookie-pair)
557555
if (!cookies.empty()) {
556+
// Get rid of any optional whitespace after the cookie-string
557+
// (i.e. after the end of the final cookie-pair)
558558
std::string& final_cookie_pair = cookies.back();
559559
while (!final_cookie_pair.empty() && isspace(final_cookie_pair.back())) {
560560
final_cookie_pair.pop_back();
@@ -586,7 +586,7 @@ int Transaction::addRequestHeader(const std::string& key,
586586
}
587587

588588
// ltrim the key - following the modsec v2 way
589-
while (ckey.empty() == false && ckey.at(0) == ' ') {
589+
while (ckey.empty() == false && isspace(ckey.at(0))) {
590590
ckey.erase(0, 1);
591591
localOffset++;
592592
}

0 commit comments

Comments
 (0)