From e0e6079c9141a0c2d7d2a6dda50496e237bfc8bb Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 2 Sep 2014 12:27:47 +0000 Subject: src/server: refactoring to isolate dependencies on the cgi/fastcgi packages * Introducing the module CGI, re-exporting a subset of the cgi package. It might complete replace the cgi package in the future. * Introducing the module CGIUtils, containing functions from FastCGIUtils that have nothing to do with fastcgi. Some low level hackery with unsafePerformIO and global variables was left in FastCGIUtils, but it is actually not used, neither for gf -server nor exec/pgf-fcgi.hs. --- src/server/PGFService.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/server/PGFService.hs') diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs index 316509d1f..2a73462ff 100644 --- a/src/server/PGFService.hs +++ b/src/server/PGFService.hs @@ -7,7 +7,11 @@ import PGF (PGF) import qualified PGF import PGF.Lexing import Cache -import FastCGIUtils +import CGIUtils(outputJSONP,outputPlain,outputHTML,logError,outputBinary, + outputBinary',handleCGIErrors,throwCGIError,stderrToFile) +import CGI(CGI,readInput,getInput,getVarWithDefault, + CGIResult,requestAcceptLanguage,handleErrors,setHeader, + Accept(..),Language(..),negotiate,liftIO) import URLEncoding #if C_RUNTIME @@ -18,7 +22,6 @@ import qualified PGF2 as C import Data.Time.Clock(UTCTime) import Data.Time.Format(formatTime) import System.Locale(defaultTimeLocale,rfc822DateFormat) -import Network.CGI import Text.JSON import Text.PrettyPrint as PP(render, text, (<+>)) import qualified Codec.Binary.UTF8.String as UTF8 (decodeString) @@ -687,9 +690,7 @@ outputGraphviz code = "gv" -> outputPlain code _ -> outputFPS' fmt =<< liftIO (pipeIt2graphviz fmt code) where - outputFPS' fmt bs = - do setHeader "Content-Type" (mimeType fmt) - outputFPS bs + outputFPS' = outputBinary' . mimeType mimeType fmt = case fmt of -- cgit v1.2.3