httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1352911 - /httpd/httpd/trunk/server/protocol.c
Date Fri, 22 Jun 2012 14:57:31 GMT
Author: sf
Date: Fri Jun 22 14:57:30 2012
New Revision: 1352911

URL: http://svn.apache.org/viewvc?rev=1352911&view=rev
Log:
Make sure that a triggering LimitRequestFieldSize is always logged, even if the
first read already exeeds the limit and ap_rgetline does not return a header
name.

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

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1352911&r1=1352910&r2=1352911&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Fri Jun 22 14:57:30 2012
@@ -746,19 +746,29 @@ AP_DECLARE(void) ap_get_mime_headers_cor
              * finding the end-of-line.  This is only going to happen if it
              * exceeds the configured limit for a field size.
              */
-            if (rv == APR_ENOSPC && field) {
-                /* ensure ap_escape_html will terminate correctly */
-                field[len - 1] = '\0';
+            if (rv == APR_ENOSPC) {
+                const char *field_escaped;
+                if (field) {
+                    /* ensure ap_escape_html will terminate correctly */
+                    field[len - 1] = '\0';
+                    field_escaped = ap_escape_html(r->pool, field);
+                }
+                else {
+                    field_escaped = field = "";
+                }
+
                 apr_table_setn(r->notes, "error-notes",
                                apr_psprintf(r->pool,
                                            "Size of a request header field "
                                            "exceeds server limit.<br />\n"
                                            "<pre>\n%.*s\n</pre>\n", 
-                                           field_name_len(field), 
-                                           ap_escape_html(r->pool, field)));
+                                           field_name_len(field_escaped),
+                                           field_escaped));
                 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00561)
-                              "Request header exceeds LimitRequestFieldSize: "
-                              "%.*s", field_name_len(field), field);
+                              "Request header exceeds LimitRequestFieldSize%s"
+                              "%.*s",
+                              *field ? ": " : "",
+                              field_name_len(field), field);
             }
             return;
         }



Mime
View raw message