Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Can't get Haskell FastCGI to work.

Name: Anonymous 2009-06-06 20:43

Test.hs

module Main where
import Control.Monad (liftM)
import Data.Maybe (fromMaybe)
import Network.FastCGI
import Text.XHtml.Strict

hello :: Int -> Html
hello 0 = h1 << "Welcome"
          +++ p << "This is the first time I've seen you."
hello c = h1 << "Welcome back!"
          +++ p << ("I have seen you " ++ show c ++ case c of
                                                      1 -> " time before"
                                                      _ -> " times before")

page :: String -> Html -> Html
page t b = header << thetitle << t +++ body << b

cgiMain :: CGI CGIResult
cgiMain = do
  c <- liftM (fromMaybe 0) $ readCookie "mycookie"
  setCookie (newCookie "mycookie" $ show (c + 1))
  output $ showHtml $ page "Cookie example" $ hello c

main :: IO ()
main = runFastCGI $ handleErrors cgiMain



$ ghc --make Test
$ ./Test
Test: user error (FCGX_Accept failed with error code: -88)


Maybe I'll just stick with CGI... how much more resources does plain CGI really take?

Name: Anonymous 2009-06-06 20:51

I have an Apache server to test it on, and regular CGI works fine, but FastCGI doesn't. I'm sure that the mod_fastcgi is loaded, because Apache says it is.

Are you using Arch Linux, too?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List