summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-05-16 14:03:09 +0000
committerhallgren <hallgren@chalmers.se>2012-05-16 14:03:09 +0000
commit114788a3db475540194bf74d4e45c4f4d1138d5e (patch)
tree8fcc90d5ddac30e23c6c4db53c8ebabdfd2648b1
parent5ac7bfc326ff903dadb8313e8f65b93cea230f58 (diff)
GFServer.hs: apply UTF8 decoding to all server input
-rw-r--r--src/compiler/GFServer.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs
index 6525b6d28..61735a658 100644
--- a/src/compiler/GFServer.hs
+++ b/src/compiler/GFServer.hs
@@ -94,8 +94,8 @@ handle_fcgi execute1 state0 stateM cache =
handle state0 cache execute1
rq@(Request method URI{uriPath=upath,uriQuery=q} hdrs body) state =
case method of
- "POST" -> normal_request (inputs body)
- "GET" -> normal_request (inputs q)
+ "POST" -> normal_request (utf8inputs body)
+ "GET" -> normal_request (utf8inputs q)
_ -> return (state,resp501 $ "method "++method)
where
normal_request qs =
@@ -159,7 +159,7 @@ handle state0 cache execute1
return (state',ok200 output)
parse qs =
- return (state,json200 (makeObj(map(parseModule.apBoth decodeString) qs)))
+ return (state,json200 (makeObj(map parseModule qs)))
cloud dir cmd qs =
case cmd of
@@ -394,6 +394,7 @@ toHeader s = FCGI.HttpExtensionHeader s -- cheating a bit
-- * misc utils
+utf8inputs = mapBoth decodeString . inputs
inputs = queryToArguments . fixplus
where
@@ -402,6 +403,7 @@ inputs = queryToArguments . fixplus
decode c = [c]
mapFst f xys = [(f x,y)|(x,y)<-xys]
+mapBoth = map . apBoth
apBoth f (x,y) = (f x,f y)
prop n v = (n,showJSON v)