ngx-export 0.4.0.0 → 0.4.1.0
raw patch · 3 files changed
+38/−21 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Changelog.md +13/−9
- NgxExport.hs +24/−11
- ngx-export.cabal +1/−1
Changelog.md view
@@ -1,33 +1,37 @@+### 0.4.1.0++- Bugfix: keep calling *fdWriteBuf* until it writes complete buffer.+ ### 0.4.0.0 -- all asynchronous handlers can now report events via eventfd channels-- new dependency on package *binary* (>= 0.8.1.0)+- All asynchronous handlers can now report events via eventfd channels.+- New dependency on package *binary* (>= 0.8.1.0). ### 0.3.2.2 -- stricter constraints for packages *base* (>= 4.8 && < 5) and- *template-haskell* (>= 2.11.0.0)+- Stricter constraints for packages *base* (>= 4.8 && < 5) and+ *template-haskell* (>= 2.11.0.0). ### 0.3.2.0 -- versioning security: get number of required version parts from C code.+- Versioning security: get number of required version parts from C code. ### 0.3.1.0 -- added versioning support to test for compatibility in C code.+- Added versioning support to test for compatibility in C code. ### 0.3.0.0 -- added an asynchronous client request body handler exported with+- Added an asynchronous client request body handler exported with *ngxExportAsyncOnReqBody* for using in a new Nginx directive *haskell_run_async_on_request_body*. ### 0.2.5.1 -- added signatures for type-checkers and exporters to prevent warnings when+- Added signatures for type-checkers and exporters to prevent warnings when reifying in a user code with *-Wmissing-signatures* or *-Wall* enabled. ### 0.2.5.0 -- added a synchronous handler in IO Monad exported with *ngxExportIOYY*.+- Added a synchronous handler in IO Monad exported with *ngxExportIOYY*.
NgxExport.hs view
@@ -48,6 +48,7 @@ import System.Posix.IO import Control.Monad import Control.Exception hiding (Handler)+import GHC.IO.Exception (ioe_errno) import Control.Concurrent.Async import Data.Maybe import qualified Data.ByteString as B@@ -58,10 +59,11 @@ import Paths_ngx_export (version) import Data.Version -pattern I l <- (fromIntegral -> l)-pattern PtrLen s l <- (s, I l)+pattern I i <- (fromIntegral -> i)+pattern PtrLen s l <- (s, I l) pattern PtrLenFromMaybe s l <- (fromMaybe (nullPtr, -1) -> PtrLen s l)-pattern EmptyLBS <- (L.null -> True)+pattern ToBool i <- ((/= 0) -> i)+pattern EmptyLBS <- (L.null -> True) data NgxExport = SS (String -> String) | SSS (String -> String -> String)@@ -384,22 +386,33 @@ ) ) `finally`- ((if efd- then void $ B.unsafeUseAsCString asyncIOFlag8b- (\(castPtr -> s) -> fdWriteBuf fd s 8)- else B.unsafeUseAsCString asyncIOFlag1b- (\(castPtr -> s) -> fdWriteBuf fd s 1) >> closeFd fd- ) `catchIOError` const (return ())+ (let writeBufN n s w+ | w < n = (w +) <$>+ fdWriteBuf fd (plusPtr s $ fromIntegral w) (n - w)+ `catchIOError`+ (\e -> return $+ if ioe_errno e == Just ((\(Errno e) -> e) eINTR)+ then 0+ else n+ ) >>= writeBufN n s+ | otherwise = return w+ writeFlag1b = void $+ B.unsafeUseAsCString asyncIOFlag1b $ flip (writeBufN 1) 0+ writeFlag8b = void $+ B.unsafeUseAsCString asyncIOFlag8b $ flip (writeBufN 8) 0+ in if efd+ then writeFlag8b+ else writeFlag1b >> closeFd fd `catchIOError` const (return ()) ) asyncIOYY :: NgxExport -> CString -> CInt -> CInt -> CUInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()-asyncIOYY (IOYY f) x (I n) fd ((/= 0) -> efd) ((/= 0) -> fstRun) =+asyncIOYY (IOYY f) x (I n) fd (ToBool efd) (ToBool fstRun) = asyncIOCommon (B.unsafePackCStringLen (x, n) >>= flip f fstRun) fd efd asyncIOYYY :: NgxExport -> Ptr NgxStrType -> CInt -> CString -> CInt -> CInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()-asyncIOYYY (IOYYY f) b (I m) x (I n) fd ((/= 0) -> efd) =+asyncIOYYY (IOYYY f) b (I m) x (I n) fd (ToBool efd) = asyncIOCommon (do b' <- peekNgxStringArrayLenY b m
ngx-export.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-version: 0.4.0.0+version: 0.4.1.0 synopsis: Helper module for Nginx haskell module description: Helper module for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>