Browse Source

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
personal/stbuehler/mod-csrf-old
Glenn Strauss 6 years ago
parent
commit
2f21aaa973
  1. 2
      src/mod_fastcgi.c
  2. 2
      src/mod_proxy.c
  3. 2
      src/mod_scgi.c

2
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;

2
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;

2
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;

Loading…
Cancel
Save