fastcgi 3001.0.2.1 → 3001.0.2.2
raw patch · 6 files changed
+5/−107 lines, 6 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- examples/Makefile +0/−14
- examples/download.hs +0/−18
- examples/hello.hs +0/−5
- examples/printinput.hs +0/−35
- examples/upload.hs +0/−32
- fastcgi.cabal +5/−3
− examples/Makefile
@@ -1,14 +0,0 @@-PROGS = upload.fcgi download.fcgi printinput.fcgi hello.fcgi--GHCFLAGS = -package fastcgi -fwarn-unused-imports--.PHONY: all clean--all: $(PROGS)--%.fcgi: %.hs- ghc $(GHCFLAGS) --make -o $@ $^ --clean:- -rm -f *.hi *.o- -rm -f $(PROGS)
− examples/download.hs
@@ -1,18 +0,0 @@--- Takes server file path from the file parameter and sends--- that to the client.--- WARNING: this script is a SECURITY RISK and only for --- demo purposes. Do not put it on a public web server.--import Network.FastCGI--form = concat ["<html><body><form>",- "<input type='text' name='file' /><br />",- "<input type='submit' />",- "</form></body></html>"]--sendFile f = do setHeader "Content-type" "application/octet-stream"- outputFile f--cgiMain = getInput "file" >>= maybe (output form) sendFile--main = runFastCGI cgiMain
− examples/hello.hs
@@ -1,5 +0,0 @@-import Network.FastCGI--cgiMain = output "Hello World!"--main = runFastCGI cgiMain
− examples/printinput.hs
@@ -1,35 +0,0 @@--- Prints the values of all CGI variables and inputs, and some --- process information.--import Control.Monad (liftM)-import Data.Maybe (fromJust)--import Control.Concurrent-import System.Posix.Process (getProcessID)--import Network.FastCGI--printinput :: CGI CGIResult-printinput = do setHeader "Content-type" "text/plain"- vs <- getVars- is <- getInputNames- i <- mapM prInput is- pid <- liftIO getProcessID- threadId <- liftIO myThreadId- let tid = concat $ drop 1 $ words $ show threadId- output $ unlines ["Environment:", prVars vs,- "Inputs:", unlines i,- "Process ID: " ++ show pid,- "Thread ID: " ++ tid]--prVars vs = unlines [k ++ ": " ++ x | (k,x) <- vs ]--prInput :: String -> CGI String-prInput i = do v <- liftM fromJust (getInput i)- f <- getInputFilename i- return $ case f of- Just n -> i ++ ": File\nfilename=" ++ n- ++ "\ncontents=" ++ v- Nothing -> i ++ ": " ++ v --main = runFastCGIorCGI printinput
− examples/upload.hs
@@ -1,32 +0,0 @@--- Accepts file uploads and saves the files in the given directory.--- WARNING: this script is a SECURITY RISK and only for --- demo purposes. Do not put it on a public web server.--import Control.Monad (liftM)-import Data.Maybe (fromJust)--import qualified Data.ByteString.Lazy as BS-import Network.FastCGI--dir = "upload"--cgiMain = do m <- getInputFilename "file"- case m of - Just n -> saveFile n- Nothing -> output form--saveFile n =- do- cont <- liftM fromJust $ getInputFPS "file"- let p = dir ++ "/" ++ basename n- liftIO $ BS.writeFile p cont- output $ "Saved as <a href='" ++ p ++ "'>" ++ p ++ "</a>."--form = concat ["<html><body><form method='post' enctype='multipart/form-data'>",- "<input type='file' name='file' /><br />",- "<input type='submit' />",- "</form></body></html>"]--basename = reverse . takeWhile (`notElem` "/\\") . reverse--main = runFastCGI cgiMain
fastcgi.cabal view
@@ -1,5 +1,5 @@ Name: fastcgi-Version: 3001.0.2.1+Version: 3001.0.2.2 Copyright: Bjorn Bringert, Lemmih Maintainer: bjorn@bringert.net License: BSD3@@ -9,6 +9,7 @@ Description: This library lets you write FastCGI programs. This package reuses the cgi package API, making it very easy to port CGI programs to FastCGI.+ The FastCGI C development kit is required to build this library. Cabal-version: >= 1.2.0 build-type: Configure extra-source-files: configure fastcgi.buildinfo.in@@ -19,11 +20,12 @@ library build-depends: cgi >= 3000.0.0 if flag(small_base)- build-depends: base >= 3.0.0.0, bytestring >= 0.9.0.1+ build-depends: base == 3.*, bytestring >= 0.9.0.1 else- build-depends: base >= 2.0+ build-depends: base == 2.* Extensions: ForeignFunctionInterface, EmptyDataDecls Exposed-Modules: Network.FastCGI ghc-options: -O2 -fwarn-unused-binds -fwarn-unused-imports -fwarn-unused-matches+ includes: fcgiapp.h extra-libraries: fcgi