Bug 53104 - LogFormat "%{xyz}C" truncates cookie content at '=' character
Summary: LogFormat "%{xyz}C" truncates cookie content at '=' character
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_log_config (show other bugs)
Version: 2.2.22
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-18 23:43 UTC by jralbert
Modified: 2012-08-21 16:26 UTC (History)
2 users (show)



Attachments
mod_log_config cookie logging 2.2 patch (823 bytes, patch)
2012-04-19 17:41 UTC, Greg Ames
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jralbert 2012-04-18 23:43:17 UTC
When using the '%{xyz}C' syntax to include the content of a specific named cookie in a LogFormat definition, log lines describing requests in which the cookie's content contains an '=' (equals sign) character will truncate the printed cookie content at the first '=' character. A conversation with sfritsch on #httpd-dev suggests that this may have cropped up as an unintended consequence of changes that were made to resolve PR 28037. Details follow; please let me know if there's anything else I can do to help clarify this issue.

------------------
Steps to Reproduce
------------------

httpd.conf (excerpt):
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"__utma=%{__utma}C; __utmb=%{__utmb}C; __utmc=%{__utmc}C; __utmk=%{__utmk}C; __utmx=%{__utmx}C; __utmz=%{__utmz}C;\"" cookie_combined

Request Cookie header (excerpt):
__utmz='153100668.1330388151.35.11.utmccn=(referral)|utmcsr=somedomain.net|utmcct=/src/login.php|utmcmd=referral'

--------------
Actual Results
--------------

Access log (excerpt):
10.0.0.1 - - [18/Apr/2012:10:12:56 -0700] "GET / HTTP/1.1" 200 32440 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1096.1 Safari/536.6" "__utma=153100668.1659089300.1323803112.1334623621.1334626164.51; __utmb=-; __utmc=-; __utmk=-; __utmx=-; __utmz=153100668.1330388151.35.11.utmccn;"

----------------
Expected Results
----------------

Access log (excerpt):
10.0.0.1 - - [18/Apr/2012:10:12:56 -0700] "GET / HTTP/1.1" 200 32440 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1096.1 Safari/536.6" "__utma=153100668.1659089300.1323803112.1334623621.1334626164.51; __utmb=-; __utmc=-; __utmk=-; __utmx=-; __utmz=153100668.1330388151.35.11.utmccn=(referral)|utmcsr=somedomain.net|utmcct=/src/login.php|utmcmd=referral;"
Comment 1 Greg Ames 2012-04-19 17:41:50 UTC
Created attachment 28642 [details]
mod_log_config cookie logging 2.2 patch

The attached patch fixes it for me.  Can you give it a try?
Comment 2 jralbert 2012-04-19 22:05:04 UTC
Yes, that patch appears to solve the issue in my test environment.

(In reply to comment #1)
> Created attachment 28642 [details]
> mod_log_config cookie logging 2.2 patch
> 
> The attached patch fixes it for me.  Can you give it a try?
Comment 3 Greg Ames 2012-04-19 22:22:10 UTC
committed to httpd trunk - r1328133
Comment 4 Rainer Jung 2012-08-21 16:26:44 UTC
Applied to 2.4.x in r1359690.
Released with 2.4.3.
Applied to 2.2.x in r1374538.