]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport:
authorGraham Leggett <minfrin@apache.org>
Wed, 1 Jan 2020 23:26:43 +0000 (23:26 +0000)
committerGraham Leggett <minfrin@apache.org>
Wed, 1 Jan 2020 23:26:43 +0000 (23:26 +0000)
mod_http2: Fixed interaction with mod_reqtimeout. A loaded mod_http2 was disabling the
ssl handshake timeouts. Also, fixed a mistake of the last version that made `H2Direct`
always `on`, irregardless of configuration.

mod_http2: Multiple field length violations in the same request no longer cause
several log entries to be written.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1872230 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/http2/h2_config.c
modules/http2/h2_h2.c
modules/http2/h2_stream.c
modules/slotmem/mod_slotmem_shm.c

diff --git a/CHANGES b/CHANGES
index 4954b123e144f162007e3b47da4454b03bf60aae..e303db26cc5fdac2064d31402f2bb968774deb99 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,15 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.42
 
+  *) mod_http2: Fixed interaction with mod_reqtimeout. A loaded mod_http2 was disabling the
+     ssl handshake timeouts. Also, fixed a mistake of the last version that made `H2Direct` 
+     always `on`, irregardless of configuration. Found and reported by
+     <Armin.Abfalterer@united-security-providers.ch> and
+     <Marcial.Rion@united-security-providers.ch>. [Stefan Eissing] 
+
+  *) mod_http2: Multiple field length violations in the same request no longer cause
+     several log entries to be written. [@mkauf]
+
   *) ap_check_pipeline: clarify/simplify !max_blank_lines logic, no functional change.
      [Christophe Jaillet]
 
diff --git a/STATUS b/STATUS
index 4e73b14568d63ba7d074e49ad179ad2051811c1f..9b7aaca19d82943adbb78ad89927b7eeadd00b41 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -132,12 +132,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_http2: Fix mod_reqtimeout interworking on handshakes. Fix H2Directr config value.
-     trunk patch: http://svn.apache.org/r1870454
-                  http://svn.apache.org/r1870499
-     2.4.x patch: svn merge -c 1870454,1870499 ^/httpd/httpd/trunk .
-     +1: icing, steffenal, minfrin
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 29a0b553c8ed5945f00020ec75aed2023ddea7c6..2e33c13e3ca3aba501a870c424acdb21360d9d6d 100644 (file)
@@ -269,8 +269,7 @@ static apr_int64_t h2_srv_config_geti64(const h2_config *conf, h2_config_var_t v
         case H2_CONF_UPGRADE:
             return H2_CONFIG_GET(conf, &defconf, h2_upgrade);
         case H2_CONF_DIRECT:
-            return 1;
-            /*return H2_CONFIG_GET(conf, &defconf, h2_direct);*/
+            return H2_CONFIG_GET(conf, &defconf, h2_direct);
         case H2_CONF_TLS_WARMUP_SIZE:
             return H2_CONFIG_GET(conf, &defconf, tls_warmup_size);
         case H2_CONF_TLS_COOLDOWN_SECS:
index 4ff1d51d84eac0e4cb659a10b7a225dc529caf36..1b69fe3502ca766cf32ef64ba57e266b619fcede 100644 (file)
@@ -542,7 +542,7 @@ int h2_allows_h2_upgrade(request_rec *r)
  * Register various hooks
  */
 static const char* const mod_ssl[]        = { "mod_ssl.c", NULL};
-static const char* const mod_reqtimeout[] = { "mod_reqtimeout.c", NULL};
+static const char* const mod_reqtimeout[] = { "mod_ssl.c", "mod_reqtimeout.c", NULL};
 
 void h2_h2_register_hooks(void)
 {
@@ -553,7 +553,7 @@ void h2_h2_register_hooks(void)
      * a chance to take over before it.
      */
     ap_hook_process_connection(h2_h2_process_conn, 
-                               mod_ssl, mod_reqtimeout, APR_HOOK_LAST);
+                               mod_reqtimeout, NULL, APR_HOOK_LAST);
     
     /* One last chance to properly say goodbye if we have not done so
      * already. */
index b93ff19628025d494f0d7860b08e9184f0d9ca9d..6136baa41c915090e2f4c7a22a6f9f325ebe23d7 100644 (file)
@@ -696,19 +696,23 @@ apr_status_t h2_stream_add_header(h2_stream *stream,
     if (name[0] == ':') {
         if ((vlen) > session->s->limit_req_line) {
             /* pseudo header: approximation of request line size check */
-            ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c,  
-                          H2_STRM_LOG(APLOGNO(10178), stream, 
-                                      "Request pseudo header exceeds "
-                                      "LimitRequestFieldSize: %s"), name);
+            if (!h2_stream_is_ready(stream)) {
+                ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c,
+                              H2_STRM_LOG(APLOGNO(10178), stream,
+                                          "Request pseudo header exceeds "
+                                          "LimitRequestFieldSize: %s"), name);
+            }
             error = HTTP_REQUEST_URI_TOO_LARGE;
         }
     }
     else if ((nlen + 2 + vlen) > session->s->limit_req_fieldsize) {
         /* header too long */
-        ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c,  
-                      H2_STRM_LOG(APLOGNO(10180), stream,"Request header exceeds "
-                                  "LimitRequestFieldSize: %.*s"),
-                      (int)H2MIN(nlen, 80), name);
+        if (!h2_stream_is_ready(stream)) {
+            ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c,
+                          H2_STRM_LOG(APLOGNO(10180), stream,"Request header exceeds "
+                                      "LimitRequestFieldSize: %.*s"),
+                          (int)H2MIN(nlen, 80), name);
+        }
         error = HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE;
     }
     
@@ -720,9 +724,11 @@ apr_status_t h2_stream_add_header(h2_stream *stream,
             h2_stream_rst(stream, H2_ERR_ENHANCE_YOUR_CALM);
             return APR_ECONNRESET;
         }
-        ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c, 
-                      H2_STRM_LOG(APLOGNO(10181), stream, "Number of request headers "
-                                  "exceeds LimitRequestFields"));
+        if (!h2_stream_is_ready(stream)) {
+            ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, session->c,
+                          H2_STRM_LOG(APLOGNO(10181), stream, "Number of request headers "
+                                      "exceeds LimitRequestFields"));
+        }
         error = HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE;
     }
     
@@ -782,10 +788,12 @@ apr_status_t h2_stream_end_headers(h2_stream *stream, int eos, size_t raw_bytes)
         ctx.failed_key = NULL;
         apr_table_do(table_check_val_len, &ctx, stream->request->headers, NULL);
         if (ctx.failed_key) {
-            ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, stream->session->c,  
-                          H2_STRM_LOG(APLOGNO(10190), stream,"Request header exceeds "
-                                      "LimitRequestFieldSize: %.*s"),
-                          (int)H2MIN(strlen(ctx.failed_key), 80), ctx.failed_key);
+            if (!h2_stream_is_ready(stream)) {
+                ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, stream->session->c,
+                              H2_STRM_LOG(APLOGNO(), stream,"Request header exceeds "
+                                          "LimitRequestFieldSize: %.*s"),
+                              (int)H2MIN(strlen(ctx.failed_key), 80), ctx.failed_key);
+            }
             set_error_response(stream, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE);
             /* keep on returning APR_SUCCESS, so that we send a HTTP response and
              * do not RST the stream. */
index 6dda8f65fec3d9444f54d9983c55e415f0fb2226..b86a6e8066e353dd1ba700247e81dd19f2ddb56c 100644 (file)
@@ -21,6 +21,7 @@
  * otherwise.
  */
 
+#include <assert.h>
 #include  "ap_slotmem.h"
 
 #include "httpd.h"
@@ -400,6 +401,7 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new,
             else {
                 apr_shm_remove(fname, pool);
                 rv = apr_shm_create(&shm, size, fname, gpool);
+                assert(rv == APR_SUCCESS);
             }
         }
         else {