From 2f21aaa973a902ee237a9894bdedd6c82c8edfe2 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 11 Apr 2016 19:46:09 -0400 Subject: [PATCH] handlers can read response before sending req body (fixes #131, #2566) dynamic handlers mod_fastcgi, mod_scgi, and mod_proxy can now read response from backend prior to finishing sending request body. If the backend closes the connections (or shuts down socket write end so that lighttpd read() 0 to indicate EOF), then lighttpd will abort attempting to send request body to backend. x-ref: "mod_fastcgi should handle "quick" responses" https://redmine.lighttpd.net/issues/2566 "FastCGI FCGI_STDOUT before FCGI_STDIN bug" https://redmine.lighttpd.net/issues/131 --- src/mod_fastcgi.c | 2 +- src/mod_proxy.c | 2 +- src/mod_scgi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index 31c6444c..bdf0d0bd 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -2974,7 +2974,7 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) { fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN); fcgi_set_state(srv, hctx, FCGI_STATE_READ); } else { - fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT); + fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN|FDEVENT_OUT); } return HANDLER_WAIT_FOR_EVENT; diff --git a/src/mod_proxy.c b/src/mod_proxy.c index 43178fee..c44440f2 100644 --- a/src/mod_proxy.c +++ b/src/mod_proxy.c @@ -821,7 +821,7 @@ static handler_t proxy_write_request(server *srv, handler_ctx *hctx) { proxy_set_state(srv, hctx, PROXY_STATE_READ); fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN); } else { - fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT); + fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN|FDEVENT_OUT); } return HANDLER_WAIT_FOR_EVENT; diff --git a/src/mod_scgi.c b/src/mod_scgi.c index 66e89231..84f138f7 100644 --- a/src/mod_scgi.c +++ b/src/mod_scgi.c @@ -2355,7 +2355,7 @@ static handler_t scgi_write_request(server *srv, handler_ctx *hctx) { fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN); scgi_set_state(srv, hctx, FCGI_STATE_READ); } else { - fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT); + fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN|FDEVENT_OUT); } return HANDLER_WAIT_FOR_EVENT;