Skip to content

Commit

Permalink
warp: adjusted 'Request.hs' to build with 'bytestring < 0.11' and rem…
Browse files Browse the repository at this point in the history
…oved 'BangPatterns'
  • Loading branch information
Vlix committed Jan 14, 2024
1 parent 479b9a2 commit b017ce1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions warp/Network/Wai/Handler/Warp/Request.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -19,6 +18,7 @@ import qualified Control.Concurrent as Conc (yield)
import Data.Array ((!))
import qualified Data.ByteString as S
import qualified Data.ByteString.Builder as B
import qualified Data.ByteString.Lazy as BL (toStrict)
import qualified Data.ByteString.Unsafe as SU
import qualified Data.CaseInsensitive as CI
import qualified Data.IORef as I
Expand Down Expand Up @@ -237,8 +237,8 @@ type BSEndoList = [ByteString] -> [ByteString]

data THStatus
= THStatus
!Int -- running total byte count (excluding current header chunk)
!Int -- current header chunk byte count
Int -- running total byte count (excluding current header chunk)
Int -- current header chunk byte count
BSEndoList -- previously parsed lines
BSEndo -- bytestrings to be prepended

Expand Down Expand Up @@ -321,7 +321,7 @@ push maxTotalHeaderLength src (THStatus totalLen chunkLen reqLines prepend) bs
-- add straight to 'reqLines', otherwise first prepend then add.
addLine len chunk =
let newTotal = currentTotal + len
toBS = S.toStrict . B.toLazyByteString
toBS = BL.toStrict . B.toLazyByteString
newLine =
if chunkLen == 0 then chunk else toBS $ prepend $ B.byteString chunk
in THStatus newTotal 0 (reqLines . (newLine:)) id
Expand Down

0 comments on commit b017ce1

Please sign in to comment.