]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* We need to set r->status on each call after we noticed an EOC as
authorRuediger Pluem <rpluem@apache.org>
Mon, 4 Apr 2022 15:48:06 +0000 (15:48 +0000)
committerRuediger Pluem <rpluem@apache.org>
Mon, 4 Apr 2022 15:48:06 +0000 (15:48 +0000)
  data bucket generators like ap_die might have changed the status
  code. But we know better in this case and insist on the status
  code that we have seen in the error bucket.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899562 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_filters.c

index 0a9ff425ea209c06efbabbfc51858b80de3317a6..2f4b6499e6b9faec1cb9c8736d72086a992637a9 100644 (file)
@@ -1943,13 +1943,6 @@ apr_status_t ap_http_outerror_filter(ap_filter_t *f,
         if (AP_BUCKET_IS_EOC(e)) {
             r->connection->keepalive = AP_CONN_CLOSE;
             ctx->seen_eoc = 1;
-            /* Set the request status to the status of the first error bucket.
-             * This should ensure that we log an appropriate status code in
-             * the access log.
-             */
-            if (ctx->first_error) {
-                r->status = ctx->first_error;
-            }
         }
     }
     /*
@@ -1972,6 +1965,18 @@ apr_status_t ap_http_outerror_filter(ap_filter_t *f,
      *              EOS bucket.
      */
     if (ctx->seen_eoc) {
+        /*
+         * Set the request status to the status of the first error bucket.
+         * This should ensure that we log an appropriate status code in
+         * the access log.
+         * We need to set r->status on each call after we noticed an EOC as
+         * data bucket generators like ap_die might have changed the status
+         * code. But we know better in this case and insist on the status
+         * code that we have seen in the error bucket.
+         */
+        if (ctx->first_error) {
+            r->status = ctx->first_error;
+        }
         e = APR_BRIGADE_FIRST(b);
         while (e != APR_BRIGADE_SENTINEL(b)) {
             apr_bucket *c = e;