summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-07 23:28:26 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-07 23:28:26 +0200
commitb5f2cfc9657cb9f37f70d7caf01649ba6bf17ab6 (patch)
treef7442080181496fd0d1c6d16c0218afd73de0a37
parenta3b990fba2bc9f94b5c8fb00e20b51a8bf8bc0b8 (diff)
downloadhittpd-b5f2cfc9657cb9f37f70d7caf01649ba6bf17ab6.tar.gz
hittpd-b5f2cfc9657cb9f37f70d7caf01649ba6bf17ab6.tar.xz
hittpd-b5f2cfc9657cb9f37f70d7caf01649ba6bf17ab6.zip
respect Connection: header
-rw-r--r--hittpd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hittpd.c b/hittpd.c
index 2d47f29..5ac3a8d 100644
--- a/hittpd.c
+++ b/hittpd.c
@@ -726,10 +726,12 @@ finish_response(int i)
 
 	client[i].events = POLLRDNORM;
 
-	// HTTP 1.0 needs to close connection by server
-	// XXX unless explicit keep-alive is set
-	if (parsers[i].http_major == 1 && parsers[i].http_minor == 0)
+	if (parsers[i].flags & F_CONNECTION_CLOSE)
 		close_connection(i);
+	else if (parsers[i].flags & F_CONNECTION_KEEP_ALIVE)
+		;
+	else if (parsers[i].http_major == 1 && parsers[i].http_minor == 0)
+		close_connection(i);    // HTTP 1.0 default
 }
 
 void