void __printf(4, 5)
uh_client_error(struct client *cl, int code, const char *summary, const char *fmt, ...)
{
+ struct http_request *r = &cl->request;
va_list arg;
uh_http_header(cl, code, summary);
va_end(arg);
}
+ /* Close the connection even when keep alive is set, when it
+ * contains a request body, as it was not read and we are
+ * currently out of sync. Without handling this the body will be
+ * 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;
+ cl->request.connection_close = true;
+ }
+
uh_request_done(cl);
}