packages feed

wai-extra 1.3.0.2 → 1.3.0.3

raw patch · 3 files changed

+15/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Network/Wai/Parse.hs view
@@ -58,19 +58,25 @@ parseHttpAccept :: S.ByteString -> [S.ByteString] parseHttpAccept = map fst                 . sortBy (rcompare `on` snd)-                . map grabQ+                . map (addSpecificity . grabQ)                 . S.split 44 -- comma   where-    rcompare :: Double -> Double -> Ordering+    rcompare :: (Double,Int) -> (Double,Int) -> Ordering     rcompare = flip compare+    addSpecificity (s, q) =+        -- Prefer higher-specificity types+        let semicolons = S.count 0x3B s+            stars = S.count 0x2A s+        in (s, (q, semicolons - stars))     grabQ s =-        let (s', q) = breakDiscard 59 s -- semicolon-            (_, q') = breakDiscard 61 q -- equals sign-         in (trimWhite s', readQ $ trimWhite q')+        -- Stripping all spaces may be too harsh.+        -- Maybe just strip either side of semicolon?+        let (s', q) = S.breakSubstring ";q=" (S.filter (/=0x20) s) -- 0x20 is space+            q' = S.takeWhile (/=0x3B) (S.drop 3 q) -- 0x3B is semicolon+         in (s', readQ q')     readQ s = case reads $ S8.unpack s of                 (x, _):_ -> x                 _ -> 1.0-    trimWhite = S.dropWhile (== 32) -- space  -- | Store uploaded files in memory lbsBackEnd :: Monad m => ignored1 -> ignored2 -> Sink S.ByteString m L.ByteString
test/WaiExtraTest.hs view
@@ -97,8 +97,8 @@  caseParseHttpAccept :: Assertion caseParseHttpAccept = do-    let input = "text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c"-        expected = ["text/html", "text/x-c", "text/x-dvi", "text/plain"]+    let input = "text/plain; q=0.5, text/html;charset=utf-8, text/*;q=0.8;ext=blah, text/x-dvi; q=0.8, text/x-c"+        expected = ["text/html;charset=utf-8", "text/x-c", "text/x-dvi", "text/*", "text/plain"]     expected @=? parseHttpAccept input  parseRequestBody' :: BackEnd L.ByteString
wai-extra.cabal view
@@ -1,5 +1,5 @@ Name:                wai-extra-Version:             1.3.0.2+Version:             1.3.0.3 Synopsis:            Provides some basic WAI handlers and middleware. Description:         The goal here is to provide common features without many dependencies. License:             MIT