From 5f8f5c154ae0327d69e51256370554ee5d6a46b8 Mon Sep 17 00:00:00 2001 From: Akshay Mankar Date: Tue, 12 Dec 2023 14:59:48 +0100 Subject: [PATCH 1/3] warp: Send `Connection: close` when closing the conn --- warp/Network/Wai/Handler/Warp/Response.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/warp/Network/Wai/Handler/Warp/Response.hs b/warp/Network/Wai/Handler/Warp/Response.hs index e8bc8df5..d9121f0a 100644 --- a/warp/Network/Wai/Handler/Warp/Response.hs +++ b/warp/Network/Wai/Handler/Warp/Response.hs @@ -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. @@ -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 From 2171acc0389a5c3c09c6a6488cb7efb7f660069a Mon Sep 17 00:00:00 2001 From: Akshay Mankar Date: Tue, 12 Dec 2023 15:48:20 +0100 Subject: [PATCH 2/3] warp: Bump version to 3.3.32 --- warp/warp.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp/warp.cabal b/warp/warp.cabal index 99b266f8..4f939e6d 100644 --- a/warp/warp.cabal +++ b/warp/warp.cabal @@ -1,5 +1,5 @@ Name: warp -Version: 3.4.1 +Version: 3.4.2 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE From 8b20c9db265a202a2c7ba2a9ec8786a1ee59957b Mon Sep 17 00:00:00 2001 From: Akshay Mankar Date: Tue, 12 Dec 2023 15:51:53 +0100 Subject: [PATCH 3/3] warp: Update changelog --- warp/ChangeLog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/warp/ChangeLog.md b/warp/ChangeLog.md index 89e9d41f..8cad78c5 100644 --- a/warp/ChangeLog.md +++ b/warp/ChangeLog.md @@ -1,5 +1,11 @@ # ChangeLog for warp + +## 3.4.2 + +* Respond with `Connection: close` header if connection is to be closed after a request. + [#958](https://github.com/yesodweb/wai/pull/958) + ## 3.4.1 * Using time-manager v0.1.0, and auto-update v0.2.0.