]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Report a broken backend in case reading the response line failed on the
authorRuediger Pluem <rpluem@apache.org>
Tue, 5 Apr 2022 14:18:09 +0000 (14:18 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 5 Apr 2022 14:18:09 +0000 (14:18 +0000)
  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

modules/proxy/mod_proxy_http.c

index 0d335961291a69cf8530fad618a7554bbca31fb6..97900b1d448b905b218829f9a80fefafc24ea33d 100644 (file)
@@ -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)