File tree Expand file tree Collapse file tree
warp/Network/Wai/Handler/Warp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -293,16 +293,16 @@ push maxTotalHeaderLength src (THStatus totalLen chunkLen reqLines prepend) bs
293293 0 -> True
294294 1 -> SU. unsafeHead bs == _cr
295295 _ -> False
296- addEither p =
297- if p then addChunk else addLine
298- -- addLine: take the current chunk and add to 'lines' as optimal as possible
299- addLine len chunk =
300- let newTotal = currentTotal + len
301- newLine =
302- if chunkLen == 0
303- then chunk
304- else S. toStrict $ B. toLazyByteString $ prepend $ B. byteString chunk
305- in THStatus newTotal 0 (reqLines . (newLine : )) id
296+ addEither isMultiline len chunk
297+ | isMultiline = addChunk len chunk
298+ -- addLine: take the current chunk and add to 'lines' as optimal as possible
299+ | otherwise =
300+ let newTotal = currentTotal + len
301+ toBS = S. toStrict . B. toLazyByteString
302+ newLine =
303+ if chunkLen == 0 then chunk else toBS $ prepend $ B. byteString chunk
304+ in THStatus newTotal 0 (reqLines . (newLine : )) id
305+ {-# INLINE addChunk #-}
306306 -- addChunk: take the current chunk and add to 'prepend' as optimal as possible
307307 addChunk len chunk =
308308 let newChunkTotal = chunkLen + len
You can’t perform that action at this time.
0 commit comments