Also close connection if response's headers contains connection: close (#33)

This commit is contained in:
Christophe Raffalli 2021-12-16 05:54:48 -10:00 committed by Simon Cruanes
parent 0c94a8aab0
commit a5e2e47b17
No known key found for this signature in database
GPG key ID: 4AC01D0849AA62B6

View file

@ -1089,7 +1089,10 @@ let handle_client_ (self:t) (client_sock:Unix.file_descr) : unit =
(* how to reply *) (* how to reply *)
let resp r = let resp r =
try Response.output_ oc r try
if Headers.get "connection" r.Response.headers = Some"close" then
continue := false;
Response.output_ oc r
with Sys_error _ -> continue := false with Sys_error _ -> continue := false
in in