forked from GitHub/gf-core
the pgf service now compiles with the latest CGI package
This commit is contained in:
@@ -8,7 +8,7 @@ module FastCGIUtils (initFastCGI, loopFastCGI,
|
|||||||
splitBy) where
|
splitBy) where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.OldException
|
import Control.Exception
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Dynamic
|
import Data.Dynamic
|
||||||
import Data.IORef
|
import Data.IORef
|
||||||
@@ -143,17 +143,19 @@ stderrToFile s = return ()
|
|||||||
-- * General CGI Error exception mechanism
|
-- * General CGI Error exception mechanism
|
||||||
|
|
||||||
data CGIError = CGIError { cgiErrorCode :: Int, cgiErrorMessage :: String, cgiErrorText :: [String] }
|
data CGIError = CGIError { cgiErrorCode :: Int, cgiErrorMessage :: String, cgiErrorText :: [String] }
|
||||||
deriving Typeable
|
deriving (Show,Typeable)
|
||||||
|
|
||||||
|
instance Exception CGIError where
|
||||||
|
toException e = SomeException e
|
||||||
|
fromException (SomeException e) = cast e
|
||||||
|
|
||||||
throwCGIError :: Int -> String -> [String] -> CGI a
|
throwCGIError :: Int -> String -> [String] -> CGI a
|
||||||
throwCGIError c m t = throwCGI $ DynException $ toDyn $ CGIError c m t
|
throwCGIError c m t = throwCGI $ toException $ CGIError c m t
|
||||||
|
|
||||||
handleCGIErrors :: CGI CGIResult -> CGI CGIResult
|
handleCGIErrors :: CGI CGIResult -> CGI CGIResult
|
||||||
handleCGIErrors x = x `catchCGI` \e -> case e of
|
handleCGIErrors x = x `catchCGI` \e -> case fromException e of
|
||||||
DynException d -> case fromDynamic d of
|
Nothing -> throw e
|
||||||
Nothing -> throw e
|
Just (CGIError c m t) -> outputError c m t
|
||||||
Just (CGIError c m t) -> outputError c m t
|
|
||||||
_ -> throw e
|
|
||||||
|
|
||||||
-- * General CGI and JSON stuff
|
-- * General CGI and JSON stuff
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ license-file: LICENSE
|
|||||||
synopsis: FastCGI Server for Grammatical Framework
|
synopsis: FastCGI Server for Grammatical Framework
|
||||||
|
|
||||||
executable pgf-server
|
executable pgf-server
|
||||||
build-depends: base,
|
build-depends: base >= 4,
|
||||||
old-time,
|
old-time,
|
||||||
directory,
|
directory,
|
||||||
filepath,
|
filepath,
|
||||||
containers,
|
containers,
|
||||||
|
process,
|
||||||
gf >= 3.1,
|
gf >= 3.1,
|
||||||
cgi >= 3001.1.7.0,
|
cgi >= 3001.1.7.0,
|
||||||
fastcgi >= 3001.0.2.1,
|
fastcgi >= 3001.0.2.1,
|
||||||
@@ -27,32 +28,3 @@ executable pgf-server
|
|||||||
ghc-options: -threaded
|
ghc-options: -threaded
|
||||||
if os(windows)
|
if os(windows)
|
||||||
ghc-options: -optl-mwindows
|
ghc-options: -optl-mwindows
|
||||||
|
|
||||||
executable morpho-server
|
|
||||||
build-depends: base,
|
|
||||||
old-time,
|
|
||||||
directory,
|
|
||||||
filepath,
|
|
||||||
containers,
|
|
||||||
gf >= 3.1,
|
|
||||||
cgi >= 3001.1.7.0,
|
|
||||||
fastcgi >= 3001.0.2.1,
|
|
||||||
json >= 0.3.3,
|
|
||||||
utf8-string >= 0.3.1.1,
|
|
||||||
bytestring,
|
|
||||||
pretty,
|
|
||||||
array,
|
|
||||||
process,
|
|
||||||
mtl,
|
|
||||||
random
|
|
||||||
if !os(windows)
|
|
||||||
build-depends: unix
|
|
||||||
main-is: MorphoService.hs
|
|
||||||
other-modules:
|
|
||||||
FastCGIUtils
|
|
||||||
Cache
|
|
||||||
URLEncoding
|
|
||||||
GF.Grammar.Parser
|
|
||||||
hs-source-dirs: ../compiler ../runtime/haskell . ../../dist/build/autogen
|
|
||||||
if os(windows)
|
|
||||||
ghc-options: -optl-mwindows
|
|
||||||
|
|||||||
Reference in New Issue
Block a user