Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last update for warp 3.3.30 #947

Merged
merged 4 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion warp/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions warp/Network/Wai/Handler/Warp/IO.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}

module Network.Wai.Handler.Warp.IO where

import Control.Exception (mask_)
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't Int64 good enough?

Copy link
Contributor Author

@Vlix Vlix Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also be fine, but then we'd have to fromIntegral it to Integer at the next step anyway. So thought, why not just do Integer immediately.

EDIT: This reminded me I hadn't actually removed the fromIntegral, I've done that now.

writeBuffer <- readIORef writeBufferRef
loop writeBuffer firstWriter 0
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion warp/Network/Wai/Handler/Warp/Response.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

----------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion warp/test/RunSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion warp/warp.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading