From 4816f954d8f7536c3b5947f711e52c2c39efacbf Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Mon, 4 Apr 2022 15:48:06 +0000 Subject: [PATCH] * 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899562 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_filters.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index 0a9ff425ea2..2f4b6499e6b 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -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; -- 2.47.2