[core] disable Nagle if streaming to backend

disable Nagle algorithm if streaming to backend and content-length
is unknown at the point where lighttpd is about to begin sending
data to backend
personal/stbuehler/mod-csrf
Glenn Strauss 2017-09-23 13:11:26 -04:00
parent 09b2b146e1
commit cbb5ee621c
1 changed files with 10 additions and 0 deletions

View File

@ -1796,6 +1796,16 @@ static handler_t gw_write_request(server *srv, gw_handler_ctx *hctx) {
if (HANDLER_GO_ON != rc) return rc;
}
/*(disable Nagle algorithm if streaming and content-length unknown)*/
if (AF_UNIX != hctx->host->family) {
connection *con = hctx->remote_conn;
if (-1 == con->request.content_length) {
if (-1 == fdevent_set_tcp_nodelay(hctx->fd, 1)) {
/*(error, but not critical)*/
}
}
}
fdevent_event_add(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN);
gw_set_state(srv, hctx, GW_STATE_WRITE);
/* fall through */