diff options
author | Ryan Bloom <rbb@apache.org> | 2000-11-30 01:31:03 +0100 |
---|---|---|
committer | Ryan Bloom <rbb@apache.org> | 2000-11-30 01:31:03 +0100 |
commit | f98dcb99c587d8e2bd0f5d6173512a8aeeea4dcf (patch) | |
tree | b7a9878e0e7b36f7dea9e02909a977fcb2d09794 /modules/loggers/mod_log_config.c | |
parent | - Remove some "platform specific notes" from the main page where the (diff) | |
download | apache2-f98dcb99c587d8e2bd0f5d6173512a8aeeea4dcf.tar.xz apache2-f98dcb99c587d8e2bd0f5d6173512a8aeeea4dcf.zip |
Enable logging a cookie with mod_log_config
Submitted by: Sander van Zoest <sander@covalent.net>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87136 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | modules/loggers/mod_log_config.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index f052df93f1..e4b036fda9 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -125,6 +125,7 @@ * 'X' = connection aborted before the response completed. * '+' = connection may be kept alive after the response is sent. * '-' = connection will be closed after the response is sent. + * %...{FOOBAR}C: The contents of the HTTP cookie FOOBAR * %...{FOOBAR}e: The contents of the environment variable FOOBAR * %...f: filename * %...h: remote host @@ -415,6 +416,27 @@ static const char *log_env_var(request_rec *r, char *a) return apr_table_get(r->subprocess_env, a); } +static const char *log_cookie(request_rec *r, char *a) +{ + const char *cookies; + const char *start_cookie; + + if ((cookies = apr_table_get(r->headers_in, "Cookie"))) { + if ((start_cookie = ap_strstr_c(cookies,a))) { + char *cookie, *end_cookie; + start_cookie += strlen(a) + 1; /* cookie_name + '=' */ + cookie = apr_pstrdup(r->pool, start_cookie); + /* kill everything in cookie after ';' */ + end_cookie = strchr(cookie, ';'); + if (end_cookie) { + *end_cookie = '\0'; + } + return cookie; + } + } + return NULL; +} + static const char *log_request_time(request_rec *r, char *a) { apr_exploded_time_t xt; @@ -593,6 +615,9 @@ static struct log_item_list { 'c', log_connection_status, 0 }, { + 'C', log_cookie, 0 + }, + { '\0' } }; |