]> gitweb @ CieloNegro.org - Lucu.git/commitdiff
Merge branch 'master' into attoparsec
authorPHO <pho@cielonegro.org>
Sun, 4 Sep 2011 12:19:53 +0000 (21:19 +0900)
committerPHO <pho@cielonegro.org>
Sun, 4 Sep 2011 12:19:53 +0000 (21:19 +0900)
Conflicts:
Network/HTTP/Lucu/Utils.hs

Lucu.cabal
NEWS
Network/HTTP/Lucu/Utils.hs

index e1650f84836c4e3b27d1c8f87e0acb1ad2ad8548..0200e77bd667aae2a1d0108ae2222ef7a0d9f3a8 100644 (file)
@@ -8,7 +8,7 @@ Description:
         without messing around FastCGI. It is also intended to be run
         behind a reverse-proxy so it doesn't have some facilities like
         logging, client filtering or such like.
-Version: 0.7.0.2
+Version: 0.7.0.3
 License: PublicDomain
 License-File: COPYING
 Author: PHO <pho at cielonegro dot org>
diff --git a/NEWS b/NEWS
index ef224809b90d3b19378b7c97b7337c4bba0ca1ee..0690289120e12d519fd2cbfea83e50315a65d07b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Changes from 0.7.0.2 to 0.7.0.3
+-------------------------------
+* Network.HTTP.Lucu.Utils: (reported by Ján Kľuka)
+
+  - Bugfix: parseWWWFormURLEncoded now replaces each '+' to ' ', that
+    were previously left unchaged.
+
+
 Changes from 0.7.0.1 to 0.7.0.2
 -------------------------------
 * Lucu now uses base64-bytestring instead of dataenc.
index abd4556b64930789940b2f89da1e75e5fe6c7ca5..d2541691ced99dd41ac579d146224fa7657a8f7a 100644 (file)
@@ -67,11 +67,18 @@ quoteStr str = A.toAsciiBuilder "\"" ⊕
 --  > ==> [("aaa", "bbb"), ("ccc", "ddd")]
 parseWWWFormURLEncoded ∷ String → [(String, String)]
 parseWWWFormURLEncoded src
-    | src == "" = []
-    | otherwise = do pairStr <- splitBy (\ c → c == ';' || c == '&') src
-                     let (key, value) = break (== '=') pairStr
-                     return ( unEscapeString key
-                            , unEscapeString $ case value of
-                                                 ('=':val) → val
-                                                 val       → val
+    | null src  = []
+    | otherwise = do pairStr ← splitBy (\ c → c ≡ ';' ∨ c ≡ '&') src
+                     let (key, value) = break ( '=') pairStr
+                     return ( unescape key
+                            , unescape $ case value of
+                                           ('=':val) → val
+                                           val       → val
                             )
+    where
+      unescape ∷ String → String
+      unescape = unEscapeString ∘ map plusToSpace
+
+      plusToSpace ∷ Char → Char
+      plusToSpace '+' = ' '
+      plusToSpace c   = c