From: Jo-Philipp Wich Date: Mon, 27 Oct 2014 10:15:35 +0000 (+0100) Subject: client: store http code of last emitted response X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;ds=sidebyside;h=248d682e3b3887a535d4ba81fab65f3463373ac8;p=project%2Fuhttpd.git client: store http code of last emitted response Certain response types (notably 204 and 304) require a slightly different handling like emitting the response body entirely, therfore record the last code to act on it in the appropriate places. Signed-off-by: Jo-Philipp Wich --- diff --git a/client.c b/client.c index 9b8fb07..0d7029b 100644 --- a/client.c +++ b/client.c @@ -48,6 +48,8 @@ void uh_http_header(struct client *cl, int code, const char *summary) const char *enc = "Transfer-Encoding: chunked\r\n"; const char *conn; + cl->http_code = code; + if (!uh_use_chunked(cl)) enc = ""; diff --git a/uhttpd.h b/uhttpd.h index 6ef28d9..9bf8cbb 100644 --- a/uhttpd.h +++ b/uhttpd.h @@ -243,6 +243,7 @@ struct client { enum client_state state; bool tls; + int http_code; struct http_request request; struct uh_addr srv_addr, peer_addr;