You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2019/03/28 16:24:30 UTC

svn commit: r1856490 - in /httpd/httpd/trunk: modules/loggers/mod_log_forensic.c server/gen_test_char.c server/util.c

Author: ylavic
Date: Thu Mar 28 16:24:30 2019
New Revision: 1856490

URL: http://svn.apache.org/viewvc?rev=1856490&view=rev
Log:
Provide TEST_CHAR marco in test_char.h

For (internal) usage outside server/util.c, mod_log_forensic for now
and mod_cache (T_HTTP_TOKEN_STOP) in a few...

Modified:
    httpd/httpd/trunk/modules/loggers/mod_log_forensic.c
    httpd/httpd/trunk/server/gen_test_char.c
    httpd/httpd/trunk/server/util.c

Modified: httpd/httpd/trunk/modules/loggers/mod_log_forensic.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_forensic.c?rev=1856490&r1=1856489&r2=1856490&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_forensic.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_forensic.c Thu Mar 28 16:24:30 2019
@@ -123,7 +123,7 @@ static char *log_escape(char *q, const c
 {
     for ( ; *p ; ++p) {
         ap_assert(q < e);
-        if (test_char_table[*(unsigned char *)p]&T_ESCAPE_FORENSIC) {
+        if (TEST_CHAR(*p, T_ESCAPE_FORENSIC)) {
             ap_assert(q+2 < e);
             *q++ = '%';
             ap_bin2hex(p, 1, q);

Modified: httpd/httpd/trunk/server/gen_test_char.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/gen_test_char.c?rev=1856490&r1=1856489&r2=1856490&view=diff
==============================================================================
--- httpd/httpd/trunk/server/gen_test_char.c (original)
+++ httpd/httpd/trunk/server/gen_test_char.c Thu Mar 28 16:24:30 2019
@@ -167,7 +167,16 @@ int main(int argc, char *argv[])
         printf("0x%03x%c", flags, (c < 255) ? ',' : ' ');
     }
 
-    printf("\n};\n");
+    printf("\n};\n\n");
+
+    printf(
+      "/* we assume the folks using this ensure 0 <= c < 256... which means\n"
+      " * you need a cast to (unsigned char) first, you can't just plug a\n"
+      " * char in here and get it to work, because if char is signed then it\n"
+      " * will first be sign extended.\n"
+      " */\n"
+      "#define TEST_CHAR(c, f) (test_char_table[(unsigned char)(c)] & (f))\n"
+    );
 
     return 0;
 }

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1856490&r1=1856489&r2=1856490&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Thu Mar 28 16:24:30 2019
@@ -76,13 +76,6 @@
  */
 #include "test_char.h"
 
-/* we assume the folks using this ensure 0 <= c < 256... which means
- * you need a cast to (unsigned char) first, you can't just plug a
- * char in here and get it to work, because if char is signed then it
- * will first be sign extended.
- */
-#define TEST_CHAR(c, f)        (test_char_table[(unsigned char)(c)] & (f))
-
 /* Win32/NetWare/OS2 need to check for both forward and back slashes
  * in ap_getparents() and ap_escape_url.
  */