Skip to content

Commit 941fc57

Browse files
author
Stefan Fritsch
committed
Also remove trailing whitespace in the value
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@834013 13f79535-47bb-0310-9956-ffa450edef68
1 parent 39a2ee4 commit 941fc57

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

modules/loggers/mod_log_config.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static const char *log_cookie(request_rec *r, char *a)
502502
* This supports Netscape version 0 cookies while being tolerant to
503503
* some properties of RFC2109/2965 version 1 cookies:
504504
* - case-insensitive match of cookie names
505-
* - white space around the '='
505+
* - white space between the tokens
506506
* It does not support the following version 1 features:
507507
* - quoted strings as cookie values
508508
* - commas to separate cookies
@@ -518,7 +518,14 @@ static const char *log_cookie(request_rec *r, char *a)
518518
apr_collapse_spaces(name, name);
519519

520520
if (!strcasecmp(name, a) && (value = apr_strtok(NULL, "=", &last2))) {
521-
value += strspn(value, " \t"); /* Move past WS */
521+
char *last;
522+
value += strspn(value, " \t"); /* Move past leading WS */
523+
last = value + strlen(value);
524+
while (last >= value && apr_isspace(*last)) {
525+
*last = '\0';
526+
--last;
527+
}
528+
522529
return ap_escape_logitem(r->pool, value);
523530
}
524531
cookies = NULL;

0 commit comments

Comments
 (0)