packages feed

fastcgi 3001.0.2.2 → 3001.0.2.5

raw patch · 6 files changed

Files

Network/FastCGI.hsc view
@@ -3,7 +3,7 @@ -- Module      :  Network.FastCGI -- Copyright   :  (c) Bjorn Bringert 2004-2005, (c) Lemmih 2006 -- License     :  BSD-style (see the file libraries/network/LICENSE)--- +-- -- Maintainer  :  lemmih@gmail.com -- Stability   :  experimental -- Portability :  non-portable (uses FFI)@@ -28,13 +28,13 @@ import Control.Concurrent ( forkOS ) import Control.Concurrent.MVar import Control.Concurrent.QSem-import Control.Exception as Exception (catch, finally)+import Control.Exception import Control.Monad    ( liftM ) import Data.Word (Word8)-import Foreign          ( Ptr, castPtr, nullPtr, peekArray0 +import Foreign          ( Ptr, castPtr, nullPtr, peekArray0                         , alloca, mallocBytes, free, throwIfNeg_)-import Foreign.C        ( CInt, CString, CStringLen-                        , peekCString )+import Foreign.C        ( CInt(..), CString, CStringLen+                         , peekCString ) import Foreign.Storable ( Storable (..) ) import System.IO.Unsafe (unsafeInterleaveIO,unsafePerformIO) @@ -75,7 +75,10 @@ foreign import ccall unsafe "fcgiapp.h FCGX_PutStr" fcgx_putStr     :: CString -> CInt -> StreamPtr -> IO CInt -foreign import ccall threadsafe "fcgiapp.h FCGX_Accept" fcgx_accept+foreign import ccall unsafe "fcgiapp.h FCGX_FFlush" fcgx_fflush+    :: StreamPtr -> IO CInt++foreign import ccall safe "fcgiapp.h FCGX_Accept" fcgx_accept     :: Ptr StreamPtr -> Ptr StreamPtr -> Ptr StreamPtr -> Ptr Environ -> IO CInt foreign import ccall unsafe "fcgiapp.h FCGX_Finish" fcgx_finish     :: IO ()@@ -85,7 +88,7 @@ -- | Handle a single CGI request, or FastCGI requests in an infinite loop. --   This function only returns normally if it was a CGI request. --   This lets you use the same program---   as either a FastCGI or CGI program, depending on what the server +--   as either a FastCGI or CGI program, depending on what the server --   treats it as. runFastCGIorCGI :: CGI CGIResult -> IO () runFastCGIorCGI f = do fcgi <- runOneFastCGIorCGI f@@ -93,10 +96,10 @@                                else return ()  -- | Handle a single FastCGI or CGI request. This lets you use the same program---   as either a FastCGI or CGI program, depending on what the server +--   as either a FastCGI or CGI program, depending on what the server --   treats it as. runOneFastCGIorCGI :: CGI CGIResult-                   -> IO Bool -- ^ True if it was a FastCGI request, +                   -> IO Bool -- ^ True if it was a FastCGI request,                               --   False if CGI. runOneFastCGIorCGI f =     do x <- fcgx_isCGI@@ -142,8 +145,8 @@     do     vars <- environToTable env     input <- sRead ins-    output <- runCGIEnvFPS vars input (runCGIT f)-    sPutStr outs output+    output' <- runCGIEnvFPS vars input (runCGIT f)+    sPutStr outs output'   @@ -155,7 +158,7 @@ foreign import ccall unsafe "fcgiapp.h FCGX_InitRequest" fcgx_initrequest     :: Ptr FCGX_Request -> CInt -> CInt -> IO CInt -foreign import ccall threadsafe "fcgiapp.h FCGX_Accept_r" fcgx_accept_r+foreign import ccall safe "fcgiapp.h FCGX_Accept_r" fcgx_accept_r     :: Ptr FCGX_Request -> IO CInt  foreign import ccall unsafe "fcgiapp.h FCGX_Finish_r" fcgx_finish_r@@ -176,11 +179,11 @@          testReturn "FCGX_Init" $ fcgx_init          let loop = do waitQSem qsem                        reqp <- acceptRequest-                       fork (oneRequestMT f reqp+                       _ <- fork (oneRequestMT f reqp                              `finally`                             (finishRequest reqp >> signalQSem qsem))                        loop-         loop `catch` \e -> log (show e)+         loop `catch` \(e::IOException) -> log (show e)  oneRequestMT :: CGI CGIResult -> Ptr FCGX_Request -> IO () oneRequestMT f r = do@@ -188,9 +191,9 @@      vars   <- environToTable env      ins    <- peekIn r      input  <- sRead ins-     output <- runCGIEnvFPS vars input (runCGIT f)+     output' <- runCGIEnvFPS vars input (runCGIT f)      outs   <- peekOut r-     sPutStr outs output+     sPutStr outs output' -- -- * FCGX_Reqest struct --@@ -224,11 +227,14 @@  sPutStr :: StreamPtr -> Lazy.ByteString -> IO () sPutStr h str =-    mapM_ (flip BSB.unsafeUseAsCStringLen (fcgxPutCStringLen h)) (Lazy.toChunks str)+  mapM_ (flip BSB.unsafeUseAsCStringLen (fcgxPutCStringLen h))+        (Lazy.toChunks str)+  `catch` \(_ :: IOException) -> return ()  fcgxPutCStringLen :: StreamPtr -> CStringLen -> IO ()-fcgxPutCStringLen h (cs,len) =+fcgxPutCStringLen h (cs,len) = do     testReturn "FCGX_PutStr" $ fcgx_putStr cs (fromIntegral len) h+    testReturn "FCGX_FFlush" $ fcgx_fflush h  sRead :: StreamPtr -> IO Lazy.ByteString sRead h = buildByteString (fcgxGetBuf h) 4096@@ -241,7 +247,7 @@ -- * ByteString utilities -- --- | Data.ByteString.Lazy.hGetContentsN generalized to arbitrary +-- | Data.ByteString.Lazy.hGetContentsN generalized to arbitrary --   reading functions. buildByteString :: (Ptr Word8 -> Int -> IO Int) -> Int -> IO Lazy.ByteString buildByteString f k = lazyRead >>= return . Lazy.fromChunks
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
− Setup.lhs
@@ -1,7 +0,0 @@-#!/usr/bin/env runghc--> module Main where-> import Distribution.Simple--> main :: IO ()-> main = defaultMain
− configure
@@ -1,9 +0,0 @@-#!/bin/sh-#--# subst standard header path variables-if test -n "$CPPFLAGS" ; then-    echo "Found CPPFLAGS in environment: '$CPPFLAGS'"-    sed 's,@CPPFLAGS@,'"$CPPFLAGS"',g;s,@LDFLAGS@,'"$LDFLAGS"',g'  \-        < fastcgi.buildinfo.in > fastcgi.buildinfo-fi
− fastcgi.buildinfo.in
@@ -1,3 +0,0 @@-ghc-options: -optc@CPPFLAGS@-cc-options:  @CPPFLAGS@-ld-options:  @LDFLAGS@
fastcgi.cabal view
@@ -1,31 +1,27 @@-Name:           fastcgi-Version:        3001.0.2.2-Copyright:      Bjorn Bringert, Lemmih-Maintainer:     bjorn@bringert.net-License:        BSD3-license-file:   LICENSE-Category:       Network-Synopsis:       A Haskell library for writing FastCGI programs-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--flag small_base-  description: Choose the new smaller, split-up base package.--library-  build-depends: cgi >= 3000.0.0-  if flag(small_base)-    build-depends:  base == 3.*, bytestring >= 0.9.0.1-  else-    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+Name:           fastcgi
+Version:        3001.0.2.5
+Copyright:      Bjorn Bringert, Lemmih
+Maintainer:     Krasimir Angelov <kr.angelov@gmail.com>
+License:        BSD3
+license-file:   LICENSE
+Category:       Network
+Synopsis:       A Haskell library for writing FastCGI programs
+Description:
+ This library lets you write FastCGI programs. The 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.6
+build-type:     Simple
+
+source-repository head
+  type:     git
+  location: https://github.com/krangelov/fastcgi
+
+library
+  build-depends: base >= 4 && < 5, cgi >= 3000.0.0, bytestring >= 0.9.1.5
+  Extensions: ForeignFunctionInterface, EmptyDataDecls, ScopedTypeVariables
+  Exposed-Modules:
+     Network.FastCGI
+  ghc-options: -Wall
+  includes: fcgiapp.h
+  extra-libraries: fcgi