httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1754540 - /httpd/httpd/trunk/server/gen_test_char.c
Date Fri, 29 Jul 2016 15:49:02 GMT
Author: wrowe
Date: Fri Jul 29 15:49:02 2016
New Revision: 1754540

URL: http://svn.apache.org/viewvc?rev=1754540&view=rev
Log:
Introduce T_HTTP_CTRLS for efficiently finding non-text chars

Modified:
    httpd/httpd/trunk/server/gen_test_char.c

Modified: httpd/httpd/trunk/server/gen_test_char.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/gen_test_char.c?rev=1754540&r1=1754539&r2=1754540&view=diff
==============================================================================
--- httpd/httpd/trunk/server/gen_test_char.c (original)
+++ httpd/httpd/trunk/server/gen_test_char.c Fri Jul 29 15:49:02 2016
@@ -52,6 +52,7 @@
 #define T_ESCAPE_LOGITEM      (0x10)
 #define T_ESCAPE_FORENSIC     (0x20)
 #define T_ESCAPE_URLENCODED   (0x40)
+#define T_HTTP_CTRLS          (0x80)
 
 int main(int argc, char *argv[])
 {
@@ -67,6 +68,7 @@ int main(int argc, char *argv[])
            "#define T_ESCAPE_LOGITEM       (%u)\n"
            "#define T_ESCAPE_FORENSIC      (%u)\n"
            "#define T_ESCAPE_URLENCODED    (%u)\n"
+           "#define T_HTTP_CTRLS           (%u)\n"
            "\n"
            "static const unsigned char test_char_table[256] = {",
            T_ESCAPE_SHELL_CMD,
@@ -75,7 +77,8 @@ int main(int argc, char *argv[])
            T_HTTP_TOKEN_STOP,
            T_ESCAPE_LOGITEM,
            T_ESCAPE_FORENSIC,
-           T_ESCAPE_URLENCODED);
+           T_ESCAPE_URLENCODED,
+           T_HTTP_CTRLS);
 
     for (c = 0; c < 256; ++c) {
         flags = 0;
@@ -125,6 +128,14 @@ int main(int argc, char *argv[])
             flags |= T_HTTP_TOKEN_STOP;
         }
 
+        /* Catch CTRLs other than VCHAR, HT and SP, and obs-text (RFC7230 3.2)
+         * This includes only the C0 plane, not C1 (which is obs-text itself.)
+         * XXX: Need to confirm this behavior on EBCDIC architecture
+         */
+        if (!c || (apr_iscntrl(c) && c != '\t' && apr_isascii(c))) {
+            flags |= T_HTTP_CTRLS;
+        }
+
         /* For logging, escape all control characters,
          * double quotes (because they delimit the request in the log file)
          * backslashes (because we use backslash for escaping)



Mime
View raw message