web-encodings 0.2.0.1 → 0.2.1
raw patch · 2 files changed
+15/−3 lines, 2 filesdep +splitPVP ok
version bump matches the API change (PVP)
Dependencies added: split
API changes (from Hackage documentation)
+ Web.Encodings: parseHttpAccept :: String -> [String]
Files
- Web/Encodings.hs +12/−1
- web-encodings.cabal +3/−2
Web/Encodings.hs view
@@ -32,8 +32,9 @@ , FileInfo (..) , parseMultipart , parsePost- -- ** Cookies+ -- ** Specific HTTP headers , decodeCookies+ , parseHttpAccept -- * Date/time encoding , formatW3 ) where@@ -52,6 +53,7 @@ import Control.Failure import Safe import Data.Char (ord, isControl)+import Data.List.Split (splitOneOf) -- | Encode all but unreserved characters with percentage encoding. --@@ -356,6 +358,15 @@ ('=':rest) -> rest x -> x in (key', value')++-- | Parse the HTTP accept string to determine supported content types.+parseHttpAccept :: String -> [String]+parseHttpAccept = filter (not . specialHttpAccept) . splitOneOf ";,"++specialHttpAccept :: String -> Bool+specialHttpAccept ('q':'=':_) = True+specialHttpAccept ('*':_) = True+specialHttpAccept _ = False -- | Format a 'UTCTime' in W3 format; useful for setting cookies. formatW3 :: UTCTime -> String
web-encodings.cabal view
@@ -1,5 +1,5 @@ name: web-encodings-version: 0.2.0.1+version: 0.2.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -23,7 +23,8 @@ bytestring >= 0.9.1.4 && < 0.10, text >= 0.5 && < 0.6, failure >= 0.0.0 && < 0.1,- safe >= 0.2 && < 0.3+ safe >= 0.2 && < 0.3,+ split >= 0.1.2 && < 0.2 exposed-modules: Web.Encodings Web.Encodings.MimeHeader, Web.Encodings.StringLike,