pgf-service now appears to works with Apache mod_fastcgi (under Mac OS X) in
addition to lighttpd.
One difference appears to be that while lighttpd passes the name of the PGF
file in the SCRIPT_FILENAME variable, Apache passes it in PATH_TRANSLATED.
But perhaps this depends on exactly how the fastcgi service is configured.
The following is what I added to the Apache configuration file to test this:
<Directory /Library/WebServer/Documents/fcgi-bin>
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
Action pgf-service /fcgi-bin/pgf-service
AddHandler pgf-service .pgf
* Use cabal install -ffastcgi to compile the fastcgi server.
* Use cabal install -fcontent to compile the content service (off by default,
currently broken)
* Use both flag to compile both.
If you want the fastcgi server, use cabal install -ffastcgi.
This is to avoid problems when you only want to compile pgf-http and the
fastcgi library fails to install, which it usually does, since it depends on
a C library which is not installed automatically with cabal.
Along with the changes to Setup.hs it should now be enough to do
cabal install
pgf-http
open http://localhost:41296/
to run the PGF service locally and play with some example grammars in minibar.
The dependency on the fastcgi package made pgf-server difficult to compile, so
it is now split into
- pgf-fgci (main module in pgf-fcgi.hs), which is built only if fastcgi is
already installed or if you turn on the fastcgi flag (e.g. by doing
'cabal install -f fastcgi').
- pgf-http (main module in pgf-http.hs) which is always built (and hopefully
has no problematic dependencies.)
The modules FastCGIUtils and PGFService no longer depend on fastcgi.
+ PGFService.hs: add Nothing arguments in calls to PGF.parse_ and
PGF.getPArseOutput
+ gf-server.cabal: mark content-server as not buildable, since required source
files are missing.
When pfg-server servers a static file in HTTP mode, it is output as is, so
specifying charset="iso-8859-1" could be wrong.
Note: the a charset can be specified with a meta tag in HTML files,
e.g. for files in UTF-8:
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
pgf-server can now act as a standalone HTTP server. To activate this mode,
start it with
pfg-server http
to use the default port number (41296), or give an explicit port number, e.g.,
pgf-server http 8080
The HTTP server serves PGF files in the same way as the old FastCGI interface.
In addition, it also serves static files. The document root for static files
is the www subdirectory of the current directory where pgf-server is started.
In spite of these addition, backwards compatibility is maintaned. The old
FastCGI interface continues to work as before. (It is activated when
pgf-server is started without arguments.)