httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/standard mod_log_config.c
Date Thu, 30 Nov 2000 00:31:05 GMT
rbb         00/11/29 16:31:04

  Modified:    src      CHANGES
               src/modules/standard mod_log_config.c
  Log:
  Enable logging a cookie with mod_log_config
  Submitted by:	Sander van Zoest <sander@covalent.net>
  
  Revision  Changes    Path
  1.351     +2 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.350
  retrieving revision 1.351
  diff -u -r1.350 -r1.351
  --- CHANGES	2000/11/29 15:16:51	1.350
  +++ CHANGES	2000/11/30 00:31:01	1.351
  @@ -1,4 +1,6 @@
   Changes with Apache 2.0a9
  +  *) Enable logging the cookie with mod_log_config
  +     [Sander van Zoest <sander@covalent.net>]
   
     *) Fix a segfault in mod_info when it reaches the end of the configuration.
        [Jeff Trawick]
  
  
  
  1.42      +25 -0     apache-2.0/src/modules/standard/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_log_config.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- mod_log_config.c	2000/11/10 19:01:32	1.41
  +++ mod_log_config.c	2000/11/30 00:31:03	1.42
  @@ -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 @@
       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;
  @@ -591,6 +613,9 @@
       },
       {
           'c', log_connection_status, 0
  +    },
  +    {
  +        'C', log_cookie, 0
       },
       {
           '\0'
  
  
  

Mime
View raw message