implemented stripCRLF

This commit is contained in:
2021-11-24 19:07:58 -05:00
parent 05e83857a7
commit 391ffd3eea
2 changed files with 26 additions and 5 deletions

View File

@@ -132,7 +132,10 @@ readMax maxLen conn = do
-- | Strips the CR/LF characters from the end of a string, retuning
-- Nothing if they are not present
stripCRLF :: String -> Maybe String
stripCRLF = undefined
stripCRLF = \case
"" -> Nothing
"\r\n" -> Just ""
c:str -> (c:) <$> stripCRLF str
readLoop :: Int -> S.InputStream BS.ByteString -> MaybeT IO Builder
readLoop maxLen src = lift (S.read src) >>= \case