X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FHeaders.hs;h=163f6bcf55bb2a9e4f78ef680919be07df354246;hp=febbdb6271ae362dd5e3c9a57fdff0975f68771f;hb=f62b6f07bbf1eefcf552163d8f7daa6e0862ed5d;hpb=b0efa668bb881d1c9db4b852b1b9063a2db12b3d diff --git a/Network/HTTP/Lucu/Headers.hs b/Network/HTTP/Lucu/Headers.hs index febbdb6..163f6bc 100644 --- a/Network/HTTP/Lucu/Headers.hs +++ b/Network/HTTP/Lucu/Headers.hs @@ -21,6 +21,7 @@ import Data.Char import Data.List import Data.Map (Map) import qualified Data.Map as M +import Data.Ord import Data.Word import Foreign.ForeignPtr import Foreign.Ptr @@ -76,7 +77,7 @@ noCaseCmp' p1 l1 p2 l2 | otherwise = do c1 <- peek p1 c2 <- peek p2 - case toLower (w2c c1) `compare` toLower (w2c c2) of + case comparing (toLower . w2c) c1 c2 of EQ -> noCaseCmp' (p1 `plusPtr` 1) (l1 - 1) (p2 `plusPtr` 1) (l2 - 1) x -> return x @@ -194,7 +195,7 @@ headersP = do xs <- many header normalize :: String -> String normalize = trimBody . trim isWhiteSpace - trimBody = foldr (++) [] + trimBody = concat . map (\ s -> if head s == ' ' then " " else