X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=Network%2FHTTP%2FLucu%2FMIMEType.hs;h=947cb004cc8fe62c57492decb78de60636d14567;hb=f1f2bf550b80e3a7522790d6609b0a5ab18b5150;hp=396a1646dbe7a5b297c2d27c8f1b834b37131b4c;hpb=11c3854540c46bfcd9e88c2164ed554f3b6550a5;p=Lucu.git diff --git a/Network/HTTP/Lucu/MIMEType.hs b/Network/HTTP/Lucu/MIMEType.hs index 396a164..947cb00 100644 --- a/Network/HTTP/Lucu/MIMEType.hs +++ b/Network/HTTP/Lucu/MIMEType.hs @@ -9,6 +9,7 @@ module Network.HTTP.Lucu.MIMEType ) where +import qualified Data.ByteString.Lazy as B import Network.HTTP.Lucu.Parser import Network.HTTP.Lucu.Parser.Http import Network.HTTP.Lucu.Utils @@ -45,8 +46,11 @@ instance Read MIMEType where -- exception for parse error. parseMIMEType :: String -> MIMEType parseMIMEType str = case parseStr mimeTypeP str of - (Success t, _) -> t - _ -> error ("Unparsable MIME Type: " ++ str) + (Success t, r) -> if B.null r then + t + else + error ("unparsable MIME Type: " ++ str) + _ -> error ("unparsable MIME Type: " ++ str) mimeTypeP :: Parser MIMEType