allow request handlers to disable chunked reponses
[project/uhttpd.git] / client.c
index 9b8fb07025037a30c52548f1e006bb4042a01c81..85d4625ed694802147008a1e3c74e5ce095298eb 100644 (file)
--- a/client.c
+++ b/client.c
@@ -48,7 +48,9 @@ void uh_http_header(struct client *cl, int code, const char *summary)
        const char *enc = "Transfer-Encoding: chunked\r\n";
        const char *conn;
 
-       if (!uh_use_chunked(cl))
+       cl->http_code = code;
+
+       if (!cl->request.respond_chunked)
                enc = "";
 
        if (r->connection_close)
@@ -186,6 +188,8 @@ static int client_parse_request(struct client *cl, char *data)
            !conf.http_keepalive)
                req->connection_close = true;
 
+       req->respond_chunked = uh_use_chunked(cl);
+
        return CLIENT_STATE_HEADER;
 }