mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
Bug fix: add missing error handler for statically served files in pgf-server HTTP mode
This commit is contained in:
@@ -49,6 +49,7 @@ httpMain cache port = runHTTP port (do log ; serve =<< getPath)
|
|||||||
logCGI $ method++" "++uri
|
logCGI $ method++" "++uri
|
||||||
|
|
||||||
serve path =
|
serve path =
|
||||||
|
handleErrors . handleCGIErrors $
|
||||||
if takeExtension path==".pgf"
|
if takeExtension path==".pgf"
|
||||||
then cgiMain' cache path
|
then cgiMain' cache path
|
||||||
else if takeFileName path=="grammars.cgi"
|
else if takeFileName path=="grammars.cgi"
|
||||||
@@ -71,11 +72,11 @@ fcgiMain cache =
|
|||||||
getPath = getVarWithDefault "SCRIPT_FILENAME" ""
|
getPath = getVarWithDefault "SCRIPT_FILENAME" ""
|
||||||
|
|
||||||
cgiMain :: Cache PGF -> CGI CGIResult
|
cgiMain :: Cache PGF -> CGI CGIResult
|
||||||
cgiMain cache = cgiMain' cache =<< getPath
|
cgiMain cache = handleErrors . handleCGIErrors $
|
||||||
|
cgiMain' cache =<< getPath
|
||||||
|
|
||||||
cgiMain' :: Cache PGF -> FilePath -> CGI CGIResult
|
cgiMain' :: Cache PGF -> FilePath -> CGI CGIResult
|
||||||
cgiMain' cache path =
|
cgiMain' cache path =
|
||||||
handleErrors . handleCGIErrors $
|
|
||||||
do pgf <- liftIO $ readCache cache path
|
do pgf <- liftIO $ readCache cache path
|
||||||
command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString)) (getInput "command")
|
command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString)) (getInput "command")
|
||||||
pgfMain pgf command
|
pgfMain pgf command
|
||||||
|
|||||||
Reference in New Issue
Block a user