[ moving this from [EMAIL PROTECTED] to [EMAIL PROTECTED] For those not on
the Subversion lists, Subversion has an issue with escaping the contents of
the httpd log. ]
--On September 27, 2005 7:17:59 PM +0200 André Malo <[EMAIL PROTECTED]> wrote:
Only \xx is used. Well, c2x is utilized, but the logging escaper replaces
the % with an x and precedes the whole sequence with an \ (-> \xhh).
See ap_escape_logitem in server/util.c.
Ugh. What a fugly function. c2x does set it to '%hh', but
ap_escape_logitem goes and changes the % to an x.
So, any objections to this patch?
I'd like to eliminate the prefix entirely, but since it's going to take the
place of the character being converted, it's not straightforward. -- justin
Index: server/util.c
===================================================================
--- server/util.c (revision 292041)
+++ server/util.c (working copy)
@@ -1659,12 +1659,13 @@
*/
static const char c2x_table[] = "0123456789abcdef";
-static APR_INLINE unsigned char *c2x(unsigned what, unsigned char *where)
+static APR_INLINE unsigned char *c2x(unsigned what, unsigned char prefix,
+ unsigned char *where)
{
#if APR_CHARSET_EBCDIC
what = apr_xlate_conv_byte(ap_hdrs_to_ascii, (unsigned char)what);
#endif /*APR_CHARSET_EBCDIC*/
- *where++ = '%';
+ *where++ = prefix;
*where++ = c2x_table[what >> 4];
*where++ = c2x_table[what & 0xf];
return where;
@@ -1694,7 +1695,7 @@
while ((c = *s)) {
if (TEST_CHAR(c, T_ESCAPE_PATH_SEGMENT)) {
- d = c2x(c, d);
+ d = c2x(c, '%', d);
}
else {
*d++ = c;
@@ -1723,7 +1724,7 @@
}
while ((c = *s)) {
if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) {
- d = c2x(c, d);
+ d = c2x(c, '%', d);
}
else {
*d++ = c;
@@ -1810,8 +1811,7 @@
*d++ = *s;
break;
default:
- c2x(*s, d);
- *d = 'x';
+ c2x(*s, 'x', d);
d += 3;
}
}
@@ -1874,8 +1874,7 @@
ep = --d; /* break the for loop as well */
break;
}
- c2x(*s, d);
- *d = 'x';
+ c2x(*s, 'x', d);
d += 3;
}
}