Skip to content

Commit

Permalink
cohttp-lwt: server: return connection header
Browse files Browse the repository at this point in the history
  • Loading branch information
ushitora-anqou committed Mar 10, 2024
1 parent cf2ae33 commit 638c52e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cohttp-lwt/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ module Make (IO : S.IO) = struct
let keep_alive =
Http.Request.is_keep_alive req && Http.Response.is_keep_alive res
in
let res =
let headers =
Http.Header.add_unless_exists
(Http.Response.headers res)
"connection"
(if keep_alive then "keep-alive" else "close")
in
{ res with Http.Response.headers }
in
handle_response ~keep_alive oc res body
(fun () -> spec.conn_closed conn)
(fun oc -> handle_client ic oc conn spec)
Expand Down

0 comments on commit 638c52e

Please sign in to comment.