Fix mod_proxy dead host detection if connect() fails

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2704 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Stefan Bühler 2010-01-20 13:22:48 +00:00
parent d601017b75
commit da3370e82e
1 changed files with 25 additions and 4 deletions

View File

@ -1047,11 +1047,32 @@ static handler_t proxy_handle_fdevent(void *s, void *ctx, int revents) {
*
*/
proxy_connection_close(srv, hctx);
joblist_append(srv, con);
if (hctx->host) {
hctx->host->is_disabled = 1;
hctx->host->disable_ts = srv->cur_ts;
log_error_write(srv, __FILE__, __LINE__, "sbdd", "proxy-server disabled:",
hctx->host->host,
hctx->host->port,
hctx->fd);
con->http_status = 503;
con->mode = DIRECT;
/* disable this server */
hctx->host->is_disabled = 1;
hctx->host->disable_ts = srv->cur_ts;
proxy_connection_close(srv, hctx);
/* reset the enviroment and restart the sub-request */
buffer_reset(con->physical.path);
con->mode = DIRECT;
joblist_append(srv, con);
} else {
proxy_connection_close(srv, hctx);
joblist_append(srv, con);
con->mode = DIRECT;
con->http_status = 503;
}
return HANDLER_FINISHED;
}