diff options
| author | hallgren <hallgren@chalmers.se> | 2014-09-02 12:27:47 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-09-02 12:27:47 +0000 |
| commit | e0e6079c9141a0c2d7d2a6dda50496e237bfc8bb (patch) | |
| tree | 8afa517ddd94e7f9b64d8c6a44cfbb8da4e13069 /src/server/PGFService.hs | |
| parent | bfd414554d2bb114baa8acc176744d55367eabb3 (diff) | |
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.
Diffstat (limited to 'src/server/PGFService.hs')
| -rw-r--r-- | src/server/PGFService.hs | 11 |
1 files changed, 6 insertions, 5 deletions
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 |
