File apache2-mod_http2-issue-167.patch of Package apache2.18661

Index: httpd-2.4.34/modules/http2/h2_from_h1.c
===================================================================
--- httpd-2.4.34.orig/modules/http2/h2_from_h1.c	2018-05-29 23:16:29.000000000 +0200
+++ httpd-2.4.34/modules/http2/h2_from_h1.c	2019-02-27 12:39:19.503285243 +0100
@@ -22,6 +22,8 @@
 #include <apr_strings.h>
 
 #include <httpd.h>
+#define AP_STATUS_IS_HEADER_ONLY(x) ((x) == HTTP_NO_CONTENT || \
+                                     (x) == HTTP_NOT_MODIFIED)
 #include <http_core.h>
 #include <http_log.h>
 #include <http_connection.h>
@@ -586,18 +588,20 @@ apr_status_t h2_filter_headers_out(ap_fi
         }
     }
     
-    if (r->header_only) {
+    if (r->header_only || AP_STATUS_IS_HEADER_ONLY(r->status)) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
-                      "h2_task(%s): header_only, cleanup output brigade", 
+                      "h2_task(%s): headers only, cleanup output brigade", 
                       task->id);
         b = body_bucket? body_bucket : APR_BRIGADE_FIRST(bb);
         while (b != APR_BRIGADE_SENTINEL(bb)) {
             next = APR_BUCKET_NEXT(b);
             if (APR_BUCKET_IS_EOS(b) || AP_BUCKET_IS_EOR(b)) {
                 break;
-            } 
-            APR_BUCKET_REMOVE(b);
-            apr_bucket_destroy(b);
+            }
+            if (!H2_BUCKET_IS_HEADERS(b)) {
+                APR_BUCKET_REMOVE(b);
+                apr_bucket_destroy(b);
+            }
             b = next;
         }
     }
openSUSE Build Service is sponsored by