ozten (ozten) wrote,

Help! Can you run Happstack as a CGI?

Does anyone already have code for running a Happstack app as a CGi instead of a HTTP Server?

Searching for a CGI adapter or backend to Happstack, I didn't find anything. The documentation mentions you can do it... but it isn't clear if it works out of the box.

I was able to find the happstack-fastcgi package. For fun, I tried converting my app to fast-cgi, following the blog post announcing the project. No dice.
I changed
main = handleSqlError $ trace "Starting up, try port 8080" (simpleHTTP (Conf 8080 Nothing) $ handleRequest)

into
main = simpleCGI handleRequest

simpleCGI :: (ToMessage a) => ServerPartT IO a -> IO ()
simpleCGI = runFastCGIConcurrent 10 . serverPartToCGI 

I compiled with
ghc --make -package cgi -package xhtml -o main.fcgi Main.hs


when I run it via apache I get
[Tue Sep 01 23:11:12 2009] [error] [client 172.16.46.1] FastCGI: incomplete headers (0 bytes) received from server "/home/some/web/main.fcgi"


I'd really like to find out how to run my app under plain old CGI, so that I can host it at NearlyFreeSpeech. They don't support FastCGI, nor long running processes like the Server mode.
Tags: happstack, haskell, haskwhal
  • Post a new comment

    Error

    default userpic
  • 1 comment