From b5f2cfc9657cb9f37f70d7caf01649ba6bf17ab6 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 7 May 2020 23:28:26 +0200 Subject: respect Connection: header --- hittpd.c | 8 +++++--- 1 file 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 -- cgit 1.4.1