dgaudet 99/03/04 11:28:41
Modified: . STATUS htdocs/manual/mod mod_log_config.html src CHANGES src/modules/standard mod_log_config.c Log: Commit %V and \n changes to mod_log_config. Submitted by: Tony Finch <[EMAIL PROTECTED]> Revision Changes Path 1.634 +1 -11 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /home/cvs/apache-1.3/STATUS,v retrieving revision 1.633 retrieving revision 1.634 diff -u -r1.633 -r1.634 --- STATUS 1999/03/03 12:58:50 1.633 +++ STATUS 1999/03/04 19:28:36 1.634 @@ -1,5 +1,5 @@ 1.3 STATUS: - Last modified at [$Date: 1999/03/03 12:58:50 $] + Last modified at [$Date: 1999/03/04 19:28:36 $] Release: @@ -55,11 +55,6 @@ MID: <[EMAIL PROTECTED]> Status: Ken +1, Lars +1 (untested) - * Tony Finch's [PATCH] mod_log_config: support for reliably parsable logs - Allows use of C-style backslash escapes in mod_log_config format strings - MID: <[EMAIL PROTECTED]> - Status: - * Ralf's [PATCH] Shared Memory Pools Message-ID: <[EMAIL PROTECTED]> Status: Roy?: Not sure if this is intended for 1.3.x or just feedback @@ -80,11 +75,6 @@ ftp://ftp.kame.net/pub/kame/misc/apache-134-v6-19990118.diff.gz Message-ID: <[EMAIL PROTECTED]> Status: Lars +1 (on concept) - - * Tony Finch's [PATCH] to mod_log_config.c to get both the 1.3.3 - behaviour of %v and the 1.3.4 behaviour as %V. - Message-ID: <[EMAIL PROTECTED]> - Status: * Ralf's patch to fix append of target name to layout paths Message-ID: <[EMAIL PROTECTED]> 1.32 +1 -0 apache-1.3/htdocs/manual/mod/mod_log_config.html Index: mod_log_config.html =================================================================== RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_log_config.html,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- mod_log_config.html 1999/02/22 16:41:06 1.31 +++ mod_log_config.html 1999/03/04 19:28:37 1.32 @@ -143,6 +143,7 @@ %...u: Remote user (from auth; may be bogus if return status (%s) is 401) %...U: The URL path requested. %...v: The canonical ServerName of the server serving the request. +%...V: The server name according to the UseCanonicalName setting. </PRE> The `...' can be nothing at all (<EM>e.g.</EM>, <CODE>"%h %u %r %s %b"</CODE>), or it can 1.1259 +7 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1258 retrieving revision 1.1259 diff -u -r1.1258 -r1.1259 --- CHANGES 1999/02/27 17:39:46 1.1258 +++ CHANGES 1999/03/04 19:28:38 1.1259 @@ -1,5 +1,12 @@ Changes with Apache 1.3.5 + *) Add %V to mod_log_config, this logs the hostname according to the + UseCanonicalName setting (this is the pre-1.3.4 behaviour of + %v). Useful for mass vhosting. [Tony Finch <[EMAIL PROTECTED]>] + + *) Add support for \n and \t to mod_log_config, can be used to produce + more reliable logs with multiline entries. [Tony Finch <[EMAIL PROTECTED]>] + *) Fixed a few compiler nits. [John Bley <[EMAIL PROTECTED]>] *) Added some informative error messages for some failed malloc() 1.76 +58 -15 apache-1.3/src/modules/standard/mod_log_config.c Index: mod_log_config.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- mod_log_config.c 1999/02/20 00:13:27 1.75 +++ mod_log_config.c 1999/03/04 19:28:40 1.76 @@ -138,7 +138,8 @@ * %...T: the time taken to serve the request, in seconds. * %...u: remote user (from auth; may be bogus if return status (%s) is 401) * %...U: the URL path requested. - * %...v: the name of the server (i.e. which virtual host?) + * %...v: the configured name of the server (i.e. which virtual host?) + * %...V: the server name according to the UseCanonicalName setting * * The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can * indicate conditions for inclusion of the item (which will cause it @@ -417,6 +418,14 @@ r->server->port ? r->server->port : ap_default_port(r)); } +/* This respects the setting of UseCanonicalName so that + * the dynamic mass virtual hosting trick works better. + */ +static const char *log_server_name(request_rec *r, char *a) +{ + return ap_get_server_name(r); +} + static const char *log_child_pid(request_rec *r, char *a) { return ap_psprintf(r->pool, "%ld", (long) getpid()); @@ -479,6 +488,9 @@ 'e', log_env_var, 0 }, { + 'V', log_server_name, 0 + }, + { 'v', log_virtual_host, 0 }, { @@ -504,30 +516,61 @@ return NULL; } -static char *log_format_substring(pool *p, const char *start, - const char *end) -{ - char *res = ap_palloc(p, end - start + 1); - - strncpy(res, start, end - start); - res[end - start] = '\0'; - return res; -} - static char *parse_log_misc_string(pool *p, log_format_item *it, const char **sa) { - const char *s = *sa; + const char *s; + char *d; it->func = constant_item; it->conditions = NULL; + s = *sa; while (*s && *s != '%') { - ++s; + s++; } - it->arg = log_format_substring(p, *sa, s); - *sa = s; + /* + * This might allocate a few chars extra if there's a backslash + * escape in the format string. + */ + it->arg = ap_palloc(p, s - *sa + 1); + d = it->arg; + s = *sa; + while (*s && *s != '%') { + if (*s != '\\') { + *d++ = *s++; + } + else { + s++; + switch (*s) { + case '\\': + *d++ = '\\'; + s++; + break; + case 'n': + *d++ = '\n'; + s++; + break; + case 't': + *d++ = '\t'; + s++; + break; + default: + /* copy verbatim */ + *d++ = '\\'; + /* + * Allow the loop to deal with this *s in the normal + * fashion so that it handles end of string etc. + * properly. + */ + break; + } + } + } + *d = '\0'; + + *sa = s; return NULL; }