diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-10-27 11:15:35 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-10-27 11:16:44 +0100 |
commit | 248d682e3b3887a535d4ba81fab65f3463373ac8 (patch) | |
tree | 3821776be3d9f87eb0ace8749041c36aff437d41 | |
parent | 98839fdd7467f34011ef4b967b285fee3b0d8597 (diff) |
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 <jow@openwrt.org>
-rw-r--r-- | client.c | 2 | ||||
-rw-r--r-- | uhttpd.h | 1 |
2 files changed, 3 insertions, 0 deletions
@@ -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 = ""; @@ -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; |