From 893475734b9d1754a87c96768136749da2b3a2c9 Mon Sep 17 00:00:00 2001 From: craff Date: Wed, 15 Dec 2021 18:39:09 -1000 Subject: [PATCH] Also close connection if response's headers contains connection: close --- src/Tiny_httpd.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tiny_httpd.ml b/src/Tiny_httpd.ml index ae35a816..319e3851 100644 --- a/src/Tiny_httpd.ml +++ b/src/Tiny_httpd.ml @@ -1034,6 +1034,8 @@ let handle_client_ (self:t) (client_sock:Unix.file_descr) : unit = let resp r = try let r = post_process_resp r in + if Headers.get "connection" r.Response.headers = Some"close" then + continue := false; Response.output_ oc r with Sys_error _ -> continue := false in