You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 2000/02/05 14:57:35 UTC

[PATCH] Consistent escaping in LogFormat

The following patch allows one to consistently escape characters in
LogFormat strings by prefixing them with the escape backslash ("\x").
This especially allows one now to also insert percent characters via
"\%" (see PR#5696). I would have comitted it before 1.3.12, but I've
less time to test it in depth and I don't want to commit perhaps risky
or incorrect patches myself just in front of a release. The RM should
have a deeper look and review this before 1.3.12. Thanks.

Yours,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: CHANGES
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/CHANGES,v
retrieving revision 1.1509
diff -u -r1.1509 CHANGES
--- CHANGES	2000/02/05 12:33:13	1.1509
+++ CHANGES	2000/02/05 13:54:22
@@ -1,5 +1,10 @@
 Changes with Apache 1.3.12
 
+  *) Allow one to consistently escape characters in LogFormat strings 
+     by prefixing them with the escape backslash ("\x"). This especially 
+     allows one now to also insert percent characters via "\%".
+     [Monte Ohrt <mo...@ispi.net>, Ralf S. Engelschall] PR#5696
+
   *) Make implementation/descriptions of the FLAG directives
      AuthAuthoritative, MetaFiles and ExtendedStatus consistent with
      documentation and the standard way of implementation those directives.
Index: modules/standard/mod_log_config.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/modules/standard/mod_log_config.c,v
retrieving revision 1.81
diff -u -r1.81 mod_log_config.c
--- modules/standard/mod_log_config.c	2000/02/02 20:44:04	1.81
+++ modules/standard/mod_log_config.c	2000/02/05 13:53:10
@@ -594,9 +594,7 @@
 	else {
 	    s++;
 	    switch (*s) {
-	    case '\\':
-		*d++ = '\\';
-		s++;
+	    case '\0':
 		break;
 	    case 'n':
 		*d++ = '\n';
@@ -608,12 +606,7 @@
 		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.
-		 */
+		*d++ = *s++;
 		break;
 	    }
 	}

Re: [PATCH] Consistent escaping in LogFormat

Posted by Tony Finch <do...@dotat.at>.
"Ralf S. Engelschall" <rs...@engelschall.com> wrote:
>
>The following patch allows one to consistently escape characters in
>LogFormat strings by prefixing them with the escape backslash ("\x").
>This especially allows one now to also insert percent characters via
>"\%" (see PR#5696).

I'm -0 on the patch as submitted because it makes log format string
parsing less consistent with parsing by other directives and doesn't
allow you to do anything you can't already do via the %% specifier.
Usually ap_getword_conf only \-escapes the quote character; currently
mod_log_config adds to this special handling for only '\n', '\t' and
'\\'; other backslashes pass through unchanged. After the patch it
would swallow backslashes.

Tony.
-- 
               **                              **               
***   ***   ***  **** ***   *******   ***   ***  **** ***   ****
   ***   ***         *   ***       ***   ***         *   ***