summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-10-27 11:18:10 +0100
committerJo-Philipp Wich <jow@openwrt.org>2014-10-27 11:18:10 +0100
commitd09bf11d572207b79286cdb5e6253278ebec147c (patch)
tree70509ca0fd974554461bb8fd4c2532a0ca01d5e2
parent248d682e3b3887a535d4ba81fab65f3463373ac8 (diff)
downloaduhttpd2-d09bf11d572207b79286cdb5e6253278ebec147c.tar.gz
utils: do not emit eof chunk for 204/304 responses
According to RFC2616 10.2.5 and 10.3.5, 204 and 304 responses MUST NOT contain any message body, therfore do not emit an EOF chunk for such responses. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 1c21fc5..1092a7d 100644
--- a/utils.c
+++ b/utils.c
@@ -28,6 +28,10 @@ bool uh_use_chunked(struct client *cl)
if (cl->request.method == UH_HTTP_MSG_HEAD || cl->request.method == UH_HTTP_MSG_OPTIONS)
return false;
+ /* RFC2616 10.2.5, 10.3.5 */
+ if (cl->http_code == 204 || cl->http_code == 304)
+ return false;
+
return true;
}