From 9683a35573f31f4ba36a7c6579768a8ca91bc913 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Thu, 26 Jul 2012 19:13:00 +0200 Subject: [PATCH] try to connect before remove header handler to return a compliant 500 error to browser if the spush server is down --- mod_proxy_fdpass.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mod_proxy_fdpass.c b/mod_proxy_fdpass.c index 34ee2fe..9dbd0a9 100644 --- a/mod_proxy_fdpass.c +++ b/mod_proxy_fdpass.c @@ -346,6 +346,22 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, ap_filter_t *f; ap_filter_rec_t *fg; + if (strncasecmp(url, "fd://", 5) == 0) { + url += 5; + } + else { + return DECLINED; + } + + rv = get_socket_from_path(r, r->pool, url, &sock); + + if (rv != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "proxy: FD: Failed to connect to '%s' %d xxx", + url, rv); + return HTTP_INTERNAL_SERVER_ERROR; + } + fg = ap_get_output_filter_handle("HTTP_HEADER"); @@ -381,22 +397,6 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, close(mop_fd); } - if (strncasecmp(url, "fd://", 5) == 0) { - url += 5; - } - else { - return DECLINED; - } - - rv = get_socket_from_path(r, r->pool, url, &sock); - - if (rv != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FD: Failed to connect to '%s' %d xxx", - url, rv); - return HTTP_INTERNAL_SERVER_ERROR; - } - /* create a couple of sockets and pass one to the client for headers and so on */ if (socketpair(AF_UNIX, SOCK_STREAM, 0, ctrlrawsock)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, -- 2.17.1