packages feed

mime 0.3.3 → 0.3.3.2

raw patch · 5 files changed

+31/−20 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Codec/MIME/Decode.hs view
@@ -27,7 +27,7 @@ decodeBody :: String -> String -> String decodeBody enc body =  case map toLower enc of-   "base64"           -> map (chr.fromIntegral) $ Base64.decode body+   "base64"           -> Base64.decodeToString body    "quoted-printable" -> QP.decode body    _ -> body 
Codec/MIME/Parse.hs view
@@ -31,18 +31,17 @@ import Debug.Trace ( trace )  parseMIMEBody :: [(String,String)] -> String -> MIMEValue-parseMIMEBody headers_in body =-  case mimeType mty of+parseMIMEBody headers_in body = result { mime_val_headers = headers }+  where+  result = case mimeType mty of     Multipart{} -> fst (parseMultipart mty body)     Message{}   -> fst (parseMultipart mty body)-    _           -> nullMIMEValue -                    { mime_val_type    = mty-	            , mime_val_disp    = parseContentDisp headers-	            , mime_val_content = Single (processBody headers body)- 	            }-- where headers = [ (map toLower k,v) | (k,v) <- headers_in ]-       mty = fromMaybe defaultType+    _           -> nullMIMEValue { mime_val_type    = mty+                                 , mime_val_disp    = parseContentDisp headers+                                 , mime_val_content = Single (processBody headers body)+                                 }+  headers = [ (map toLower k,v) | (k,v) <- headers_in ]+  mty = fromMaybe defaultType                        (parseContentType =<< lookupField "content-type" headers) defaultType :: Type defaultType = Type { mimeType   = Text "plain"@@ -87,9 +86,16 @@     Nothing -> body     Just v  -> decodeBody v body +normalizeCRLF :: String -> String+normalizeCRLF ('\r':'\n':xs) = '\r':'\n':normalizeCRLF xs+normalizeCRLF ('\r':xs) = '\r':'\n':normalizeCRLF xs+normalizeCRLF ('\n':xs) = '\r':'\n':normalizeCRLF xs+normalizeCRLF (x:xs) = x:normalizeCRLF xs+normalizeCRLF [] = []+   parseMIMEMessage :: String -> MIMEValue parseMIMEMessage entity =-  case parseHeaders entity of+  case parseHeaders (normalizeCRLF entity) of    (as,bs) -> parseMIMEBody as bs  parseHeaders :: String -> ([(String,String)], String)@@ -217,10 +223,10 @@   ]  untilMatch :: String -> String -> Maybe String-untilMatch str xs = go str xs-  where go ""     rs      = Just rs-        go _      ""      = Nothing-        go (a:as) (b:bs)  = if a == b then go as bs else go str bs+untilMatch "" a  = Just a+untilMatch _  "" = Nothing+untilMatch a b | a `isPrefixOf` b = Just $ drop (length a) b+untilMatch a (_:bs) = untilMatch a bs  matchUntil :: String -> String -> (String, String) matchUntil _   "" = ("", "")
Codec/MIME/Type.hs view
@@ -14,7 +14,7 @@ -------------------------------------------------------------------- module Codec.MIME.Type where -import Data.List ( concatMap, isSuffixOf )+import Data.List ( isSuffixOf )  data Type  = Type
Codec/MIME/Utils.hs view
@@ -26,7 +26,7 @@  case mime_val_content mv of    Multi ms  -> msum (map (findMultipartNamed nm) ms)    Single {} -> do cd <- mime_val_disp mv-                   find (withDispName nm) (dispParams cd)+                   _ <- find (withDispName nm) (dispParams cd)                    return mv  where withDispName a (Name b) = a == b        withDispName _ _ = False
mime.cabal view
@@ -1,5 +1,5 @@ name:               mime-version:            0.3.3+version:            0.3.3.2 synopsis:           Working with MIME types. description:        Working with MIME types. category:           Codec@@ -8,8 +8,9 @@ author:             Sigbjorn Finne, Galois, Inc. maintainer:         Sigbjorn Finne <sigbjorn.finne@gmail.com> Copyright:          (c) 2006-2009 Galois Inc.-cabal-version:      >= 1.2.0+cabal-version:      >= 1.6 build-type:         Simple+homepage:           https://github.com/GaloisInc/mime Extra-Source-Files: CHANGES  library@@ -22,3 +23,7 @@                    Codec.MIME.Decode                    Codec.MIME.QuotedPrintable   ghc-options:     -Wall++source-repository head+  type:     git+  location: git://github.com/GaloisInc/mime.git