[Haskell-cafe] CGI module almost useless

Bjorn Bringert bringert at cs.chalmers.se
Fri Jun 3 07:17:42 EDT 2005


John Goerzen wrote:
> My apologies if this sounds like a bit of a rant; I know people put good
> effort into this, but....
> 
> The Network.CGI module in fptools (and GHC) is not very useful.  I think
> that it should be removed or re-tooled.  Here are the main problems with
> it:
> 
> 1. It does not permit custom generation of output headers.  Thus the CGI
> script cannot do things like set cookies, manage HTTP auth, etc.
> 
> 2. It does not permit generation of anything other than text/html
> documents.  Many CGI scripts are used to manage other types of
> documents.  Notably this makes it incompatible with serving up even
> basic things like stylesheets and JPEGs.
> 
> 3. It does not permit the use of any custom design to serve up HTML,
> forcing *everything* to go through Text.Html.  This makes it impossible
> to do things like serving up HTML files from disk.
> 
> 4. There is documentation in the code, but it is as comments only, and
> doesn't show up in the Haddock-generated GHC library reference.  (Should
> be an easy fix)
> 
> 5. It does not appear to support file uploads in any sane fashion
> 
> Is there a better CGI module out there somewhere that I'm missing, or
> should I just set about writing my own?

I wrote this module (based on the Network.CGI code) a while ago:

http://www.dtek.chalmers.se/~d00bring/darcs/blob/lib/Network/SimpleCGI.hs

I don't remember what it does really, but I think it solves issues 1,2,3 
and some of 4.

/Björn


More information about the Haskell-Cafe mailing list