File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -262,11 +262,12 @@ writeBlocks isCRLF h buf0 (Stream next0 s0 _len) = outer s0 buf0
262262 Done -> commit n False {- no flush-} True {- release-} >> return ()
263263 Skip s' -> inner s' n
264264 Yield x s'
265- | isCRLF && x == ' \n ' && n + 1 < len -> do
265+ -- Leave room for two characters for CRLF decoding
266+ | n + 1 >= len -> commit n True {- needs flush-} False >>= outer s
267+ | x == ' \n ' && isCRLF -> do
266268 n1 <- writeCharBuf' raw len n ' \r '
267269 writeCharBuf' raw len n1 ' \n ' >>= inner s'
268- | n < len -> writeCharBuf' raw len n x >>= inner s'
269- | otherwise -> commit n True {- needs flush-} False >>= outer s
270+ | otherwise -> writeCharBuf' raw len n x >>= inner s'
270271 commit = commitBuffer h raw len
271272
272273-- | Only modifies the raw buffer and not the buffer attributes
You can’t perform that action at this time.
0 commit comments