From: Matteo Nastasi (mop) Date: Thu, 26 Jul 2012 17:13:00 +0000 (+0200) Subject: try to connect before remove header handler to return a compliant 500 error to browse... X-Git-Tag: v0.1.1~3 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=9683a35573f31f4ba36a7c6579768a8ca91bc913;p=mod-proxy-fdpass.git try to connect before remove header handler to return a compliant 500 error to browser if the spush server is down --- 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,