diff --git a/warp/ChangeLog.md b/warp/ChangeLog.md index f36d3ab8e..3636d3c56 100644 --- a/warp/ChangeLog.md +++ b/warp/ChangeLog.md @@ -2,7 +2,13 @@ ## 3.3.30 -* Fixed adding superfluous `Server` header if response already has it. +* Length of `ResponseBuilder` responses will now also be passed to the logger. + [#946](https://github.com/yesodweb/wai/pull/946) +* Using `If-(None-)Match` headers simultaneously with `If-(Un)Modified-Since` headers now + follow the RFC 9110 standard. So `If-(Un)Modified-Since` headers will be correctly ignored + if their respective `-Match` counterpart is also present in the request headers. + [#945](https://github.com/yesodweb/wai/pull/945) +* Fixed adding superfluous `Server` header when using HTTP/2.0 if response already has it. [#943](https://github.com/yesodweb/wai/pull/943) ## 3.3.29 diff --git a/warp/Network/Wai/Handler/Warp/IO.hs b/warp/Network/Wai/Handler/Warp/IO.hs index eb76abedf..9cc83d8cc 100644 --- a/warp/Network/Wai/Handler/Warp/IO.hs +++ b/warp/Network/Wai/Handler/Warp/IO.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - module Network.Wai.Handler.Warp.IO where import Control.Exception (mask_) @@ -10,7 +8,7 @@ import Network.Wai.Handler.Warp.Buffer import Network.Wai.Handler.Warp.Imports import Network.Wai.Handler.Warp.Types -toBufIOWith :: Int -> IORef WriteBuffer -> (ByteString -> IO ()) -> Builder -> IO Int +toBufIOWith :: Int -> IORef WriteBuffer -> (ByteString -> IO ()) -> Builder -> IO Integer toBufIOWith maxRspBufSize writeBufferRef io builder = do writeBuffer <- readIORef writeBufferRef loop writeBuffer firstWriter 0 @@ -21,7 +19,7 @@ toBufIOWith maxRspBufSize writeBufferRef io builder = do size = bufSize writeBuffer (len, signal) <- writer buf size bufferIO buf len io - let totalBytesSent = len + bytesSent + let totalBytesSent = toInteger len + bytesSent case signal of Done -> return totalBytesSent More minSize next diff --git a/warp/Network/Wai/Handler/Warp/Response.hs b/warp/Network/Wai/Handler/Warp/Response.hs index 9a71dfdbe..7281eb18f 100644 --- a/warp/Network/Wai/Handler/Warp/Response.hs +++ b/warp/Network/Wai/Handler/Warp/Response.hs @@ -225,7 +225,7 @@ sendRsp conn _ th ver s hs _ maxRspBufSize _ (RspBuilder body needsChunked) = do | otherwise = header <> body writeBufferRef = connWriteBuffer conn len <- toBufIOWith maxRspBufSize writeBufferRef (\bs -> connSendAll conn bs >> T.tickle th) hdrBdy - return (Just s, Just $ fromIntegral len) + return (Just s, Just len) ---------------------------------------------------------------- diff --git a/warp/test/RunSpec.hs b/warp/test/RunSpec.hs index 2eb238c54..5aab5746a 100644 --- a/warp/test/RunSpec.hs +++ b/warp/test/RunSpec.hs @@ -21,7 +21,6 @@ import Network.HTTP.Types import Network.Socket import Network.Socket.ByteString (sendAll) import Network.Wai hiding (responseHeaders) -import Network.Wai.Internal (getRequestBodyChunk) import Network.Wai.Handler.Warp import System.IO.Unsafe (unsafePerformIO) import System.Timeout (timeout) diff --git a/warp/warp.cabal b/warp/warp.cabal index 081a3c80f..941417380 100644 --- a/warp/warp.cabal +++ b/warp/warp.cabal @@ -212,7 +212,7 @@ Test-Suite spec , text , time-manager , vault - , wai >= 3.2 && < 3.3 + , wai >= 3.2.2.1 && < 3.3 , word8 , unliftio if flag(x509)