From: Ruediger Pluem Date: Tue, 5 Apr 2022 14:18:09 +0000 (+0000) Subject: * Report a broken backend in case reading the response line failed on the X-Git-Tag: 2.5.0-alpha2-ci-test-only~412 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e6d9a6618e223b7177c93d4669b01341f24c652;p=thirdparty%2Fapache%2Fhttpd.git * Report a broken backend in case reading the response line failed on the first request on this connection otherwise we assume we have just run into a keepalive race and the backend is still healthy. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899584 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 0d335961291..97900b1d448 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1162,8 +1162,23 @@ int ap_proxy_http_process_response(proxy_http_req_t *req) ap_pass_brigade(r->output_filters, bb); /* Mark the backend connection for closing */ backend->close = 1; - /* Need to return OK to avoid sending an error message */ - return OK; + if (origin->keepalives) { + /* We already had a request on this backend connection and + * might just have run into a keepalive race. Hence we + * think positive and assume that the backend is fine and + * we do not need to signal an error on backend side. + */ + return OK; + } + /* + * This happened on our first request on this connection to the + * backend. This indicates something fishy with the backend. + * Return HTTP_INTERNAL_SERVER_ERROR to signal an unrecoverable + * server error. We do not worry about r->status code and a + * possible error response here as the ap_http_outerror_filter + * will fix all of this for us. + */ + return HTTP_INTERNAL_SERVER_ERROR; } if (!c->keepalives) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01105)