summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-09 18:29:45 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-09 18:29:45 +0200
commit054048798664555a1c08a1a1c358468f941e27d8 (patch)
treef7ac2e4a31a2b6332c40d3187c63dd9469c7b36e
parentd537da07206a6890855a83422f6cbe52d5328bcb (diff)
downloadhittpd-054048798664555a1c08a1a1c358468f941e27d8.tar.gz
hittpd-054048798664555a1c08a1a1c358468f941e27d8.tar.xz
hittpd-054048798664555a1c08a1a1c358468f941e27d8.zip
fix empty Content-Length for HEAD
-rw-r--r--hittpd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hittpd.c b/hittpd.c
index 4ff5ebe..13306fe 100644
--- a/hittpd.c
+++ b/hittpd.c
@@ -279,14 +279,14 @@ send_response(http_parser *p, int status, const char *msg,
 	char now[64];
 	httpdate(time(0), now);
 
-	if (p->method == HTTP_HEAD)
-		content = "";
-
 	if (content) {
 		data->first = 0;
 		data->last = strlen(content);
 	}
 
+	if (p->method == HTTP_HEAD)
+		content = "";
+
 	int len = 0;
 
 	len += snprintf(buf, sizeof buf,