Ensure that any kind of chunk data is only sent when the client connection
is in the body data state in order to avoid sending superfluous `0\r\n\r\n`
chunks on closing idle connections.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* interpreted as part of the next request. The alternative
* would be to read and discard the request body here.
*/
- if (r->transfer_chunked || r->content_length > 0) {
- cl->state = CLIENT_STATE_CLOSE;
+ if (r->transfer_chunked || r->content_length > 0)
cl->request.connection_close = true;
- }
uh_request_done(cl);
}
va_list arg2;
int len;
- if (cl->state == CLIENT_STATE_CLEANUP)
+ if (cl->state != CLIENT_STATE_DATA)
return;
uloop_timeout_set(&cl->timeout, conf.network_timeout * 1000);
if (!uh_use_chunked(cl))
return;
- if (cl->state == CLIENT_STATE_CLEANUP)
+ if (cl->state != CLIENT_STATE_DATA)
return;
ustream_printf(cl->us, "0\r\n\r\n");