Ozten Recent Activities - tagged with fastcgi http://www.ozten.com/sweetcron/feed en-us http://blogs.law.harvard.edu/tech/rss Sweetcron shout@ozten.com ozten: hello world in CGI FastCGI and Happstack FastCGI http://www.ozten.com/sweetcron/items/view/2718/ozten-hello-world-in-cgi-fastcgi-and-happstack-fastcgi

I made sure your Haskell CGI and FastCGI setup is working. Here are Hello World CGI, Fast-CGI, and Happstack on FastCGI

]]>
Thu, 03 Sep 2009 18:10:00 -0700 http://www.ozten.com/sweetcron/items/view/2718/ozten-hello-world-in-cgi-fastcgi-and-happstack-fastcgi
hello world in CGI FastCGI and Happstack FastCGI http://www.ozten.com/sweetcron/items/view/2719/hello-world-in-cgi-fastcgi-and-happstack-fastcgi

Just as a sanity check for Help! Can you run Happstack as a CGI? I made sure your Haskell CGI and FastCGI setup is working.CGI -- ghc --make -o CgiPlay.cgi CgiPlay.hs import Network.CGI

cgiMain :: CGI CGIResult cgiMain = output "Hello World!"

main :: IO () main = runCGI (handleErrors cgiMain) FastCGI -- ghc -package fastcgi -threaded --make -o FCgiPlay.fcgi FCgiPlay.hs import Control.Concurrent import System.Posix.Process (getProcessID)

import Network.FastCGI

test :: CGI CGIResult test = do setHeader "Content-type" "text/plain" pid <- liftIO getProcessID threadId <- liftIO myThreadId let tid = concat $ drop 1 $ words $ show threadId output $ unlines [ "Process ID: " ++ show pid, "Thread ID: " ++ tid]

main = runFastCGIConcurrent' forkIO 10 test Happstack on FastCGI import Happstack.Server.FastCGI import Happstack.Server.SimpleHTTP (askRq, getData, RqData, ToMessage) import Happstack.Server (look, fromData, FromData, simpleHTTP, Conf(..), toResponse, ServerPartT)

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

main = simpleCGI handleRequest

handleRequest = return $ toResponse "Howdy From Happstack on FastCGI"

]]>
Thu, 03 Sep 2009 18:09:00 -0700 http://www.ozten.com/sweetcron/items/view/2719/hello-world-in-cgi-fastcgi-and-happstack-fastcgi