From 16051d9681413d7d773ccf2096c3f929cdb33085 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Sun, 2 Oct 2005 14:32:35 +0000 Subject: [PATCH] * run the request_status hook in proxy_handler if HTTP_SERVICE_UNAVAILABLE is returned by ap_proxy_pre_request. Suggested by: Brian Akins , Mladen Turk Reviewed by: Jim Jagielski git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@293123 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index f49493a25e..568c9be777 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -679,8 +679,22 @@ static int proxy_handler(request_rec *r) char *url = uri; /* Try to obtain the most suitable worker */ access_status = ap_proxy_pre_request(&worker, &balancer, r, conf, &url); - if (access_status != OK) - return access_status; + if (access_status != OK) { + /* + * Only return if access_status is not HTTP_SERVICE_UNAVAILABLE + * This gives other modules the chance to hook into the + * request_status hook and decide what to do in this situation. + */ + if (access_status != HTTP_SERVICE_UNAVAILABLE) + return access_status; + /* + * Ensure that balancer is NULL if worker is NULL to prevent + * potential problems in the post_request hook. + */ + if (!worker) + balancer = NULL; + goto cleanup; + } if (balancer && balancer->max_attempts_set && !max_attempts) max_attempts = balancer->max_attempts; /* firstly, try a proxy, unless a NoProxy directive is active */ -- 2.40.0