Skip to content

Commit

Permalink
warp: Send Connection: close when closing the conn
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaymankar authored and MangoIV committed May 29, 2024
1 parent d50e118 commit 5f8f5c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion warp/Network/Wai/Handler/Warp/Response.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ sendResponse
-> IO Bool
-- ^ Returing True if the connection is persistent.
sendResponse settings conn ii th req reqidxhdr src response = do
hs <- addAltSvc settings <$> addServerAndDate hs0
hs <- addConnection . addAltSvc settings <$> addServerAndDate hs0
if hasBody s
then do
-- The response to HEAD does not have body.
Expand Down Expand Up @@ -149,6 +149,9 @@ sendResponse settings conn ii th req reqidxhdr src response = do
s = responseStatus response
hs0 = sanitizeHeaders $ responseHeaders response
rspidxhdr = indexResponseHeader hs0
addConnection hs = if (hasBody s && not ret) || (not (hasBody s) && not isPersist)
then (H.hConnection, "close") : hs
else hs
getdate = getDate ii
addServerAndDate = addDate getdate rspidxhdr . addServer defServer rspidxhdr
(isPersist, isChunked0) = infoFromRequest req reqidxhdr
Expand Down

0 comments on commit 5f8f5c1

Please sign in to comment.