mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-19 17:59:32 -06:00
Fix UTF-8 decoding problem in gf -server
The package network-2.4.1.1 thoughlessly introduced a backward incompatible
change to the function Network.URI.unEscapeString, see
f2168b1f89
This also affects the function Network.Shed.Httpd.queryToArguments, which is
used in GFServer.hs.
To remain compatible with older and newer versions of the network package,
we need to stay clear of queryToArguments and unEscapeString. A replacement
function has been added to server/URLEncoding.hs.
This commit is contained in:
@@ -24,8 +24,7 @@ import System.Posix.Files(getSymbolicLinkStatus,isSymbolicLink,removeLink,
|
||||
#endif
|
||||
import Control.Concurrent(newMVar,modifyMVar)
|
||||
import Network.URI(URI(..))
|
||||
import Network.Shed.Httpd(initServer,Request(..),Response(..),queryToArguments,
|
||||
noCache)
|
||||
import Network.Shed.Httpd(initServer,Request(..),Response(..),noCache)
|
||||
--import qualified Network.FastCGI as FCGI -- from hackage direct-fastcgi
|
||||
import Network.CGI(handleErrors,liftIO)
|
||||
import FastCGIUtils(handleCGIErrors)--,outputJSONP,stderrToFile
|
||||
@@ -43,6 +42,7 @@ import Paths_gf(getDataDir,version)
|
||||
import GF.Infra.BuildInfo (buildInfo)
|
||||
import SimpleEditor.Convert(parseModule)
|
||||
import RunHTTP(cgiHandler)
|
||||
import URLEncoding(decodeQuery)
|
||||
|
||||
--logFile :: FilePath
|
||||
--logFile = "pgf-error.log"
|
||||
@@ -441,11 +441,17 @@ utf8inputs q = [(decodeString k,(decodeString v,v))|(k,v)<-inputs q]
|
||||
decoded = mapSnd fst
|
||||
raw = mapSnd snd
|
||||
|
||||
inputs = decodeQuery
|
||||
{-
|
||||
-- Stay clear of queryToArgument, which uses unEscapeString, which had
|
||||
-- backward incompatible changes in network-2.4.1.1, see
|
||||
-- https://github.com/haskell/network/commit/f2168b1f8978b4ad9c504e545755f0795ac869ce
|
||||
inputs = queryToArguments . fixplus
|
||||
where
|
||||
fixplus = concatMap decode
|
||||
decode '+' = "%20" -- httpd-shed bug workaround
|
||||
decode c = [c]
|
||||
-}
|
||||
|
||||
mapFst f xys = [(f x,y)|(x,y)<-xys]
|
||||
mapSnd f xys = [(x,f y)|(x,y)<-xys]
|
||||
|
||||
Reference in New Issue
Block a user