]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_http: follow up to r1879419.
authorYann Ylavic <ylavic@apache.org>
Thu, 23 Jul 2020 14:03:24 +0000 (14:03 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 23 Jul 2020 14:03:24 +0000 (14:03 +0000)
Better ap_proxy_tunnel_run() error handling.

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

modules/proxy/mod_proxy_http.c

index 76caf2c06ae580526b0eaacf1016b72dff66f383..ca35308c1bc303e9a377764985e5d5ae3f0870cf 100644 (file)
@@ -349,7 +349,7 @@ static void proxy_http_async_cb(void *baton)
                                               proxy_http_async_cancel_cb, 
                                               req, req->idle_timeout);
     }
-    else if (status != OK) {
+    else if (ap_is_HTTP_ERROR(status)) {
         proxy_http_async_cancel_cb(req);
     }
     else {
@@ -1757,6 +1757,7 @@ int ap_proxy_http_process_response(proxy_http_req_t *req)
                 return HTTP_INTERNAL_SERVER_ERROR;
             }
 
+            r->status = HTTP_SWITCHING_PROTOCOLS;
             req->proto = upgrade;
 
             if (req->can_go_async) {
@@ -1770,11 +1771,9 @@ int ap_proxy_http_process_response(proxy_http_req_t *req)
             /* Let proxy tunnel forward everything within this thread */
             req->tunnel->timeout = req->idle_timeout;
             status = ap_proxy_tunnel_run(req->tunnel);
-            if (!ap_is_HTTP_ERROR(status)) {
-                /* Update r->status for custom log */
-                status = HTTP_SWITCHING_PROTOCOLS;
+            if (ap_is_HTTP_ERROR(status)) {
+                r->status = status;
             }
-            r->status = status;
 
             /* We are done with both connections */
             r->connection->keepalive = AP_CONN_CLOSE;