Hi.
<div><br></div><div>This is probably "I must be blind department"</div><div><br></div><div>I have a very basic strip down echo cgi that runs with apache2.</div><div><br></div><div>When I try to modfi it to be a FastCGI instead and run it with spawn-fcgi with nginx</div>
<div>It don't behave as expected.</div><div>I suppose that the line that don't get any data is mn <- getInputFPS "file" when running under FastGCI.</div><div>So is the code wrong? or have I missed something with the setup?</div>
<div><br></div><div>I can run the example of fastcgi provided in <a href="http://mult.ifario.us/p/wiring-haskell-into-a-fastcgi-web-server">http://mult.ifario.us/p/wiring-haskell-into-a-fastcgi-web-server</a> with no problem.</div>
<div><br></div><div><br></div><div>Description: Ubuntu 10.04 LTS</div><div>2.6.32-22-generic-pae #36-Ubuntu SMP</div><div>The Glorious Glasgow Haskell Compilation System, version 6.12.1</div><div><br></div><div>+++++</div>
<div><div>import Control.Concurrent</div><div>import Network.CGI</div><div>-- import Network.FastCGI</div><div>import Text.Html</div><div>import qualified Data.ByteString.Lazy as BS</div><div>import qualified Data.ByteString.Lazy.Char8 as BS8</div>
<div>import Control.Monad (liftM)</div><div>import Data.Maybe (fromJust)</div><div>import Char</div><div>import Data.List</div><div>import System.Time</div><div>import qualified Data.ByteString.Char8 as C</div><div>import Text.JSON.Generic</div>
<div>import Text.JSON</div><div><br></div><div>insertthis fb = do</div><div> let f = BS8.unpack fb</div><div> return (f)</div><div><br></div><div><br></div><div><br></div><div><br></div><div>fileForm = form ! [method "post", enctype "multipart/form-data"]</div>
<div> << [textfield "file", submit "" "Upload"]</div><div><br></div><div><br></div><div><br></div><div>saveFile cont =</div><div> do r<-liftIO $ insertthis cont</div>
<div> return $ paragraph << ("Inserted " ++ (show r))</div><div><br></div><div>page t b = header << thetitle << t +++ body << b</div><div><br></div><div><br></div><div><br></div><div>
<br></div><div>test :: CGI CGIResult</div><div>test = do setHeader "Content-Type" "text/html; charset=utf-8"</div><div> mn <- getInputFPS "file"</div><div> h <- maybe (return fileForm) saveFile mn</div>
<div><div> output $ renderHtml $ page "Upload" h</div><div><br></div><div><br></div><div>main = runCGI $ handleErrors test</div><div><br></div></div></div><div>--main= runFastCGI $ handleErrors test</div>
<div><br></div><div>+++++</div>