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>
+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.
, parseWWWFormURLEncoded
)
where
-
import Control.Monad
import Data.List hiding (last)
import Network.URI
import Prelude hiding (last)
+import Prelude.Unicode
-- |> splitBy (== ':') "ab:c:def"
-- > ==> ["ab", "c", "def"]
-- |> parseWWWFormURLEncoded "aaa=bbb&ccc=ddd"
-- > ==> [("aaa", "bbb"), ("ccc", "ddd")]
-parseWWWFormURLEncoded :: String -> [(String, String)]
+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