ngx-export 1.4.1 → 1.4.2
raw patch · 3 files changed
+32/−22 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- NgxExport: instance GHC.Exception.Exception NgxExport.ServiceHookInterrupt
+ NgxExport: instance GHC.Exception.Type.Exception NgxExport.ServiceHookInterrupt
Files
- Changelog.md +4/−0
- NgxExport.hs +27/−21
- ngx-export.cabal +1/−1
Changelog.md view
@@ -1,3 +1,7 @@+### 1.4.2++- Minor internal improvements (using tuple sections).+ ### 1.4.1 - Corrected type of *ngxCachedTimePtr*.
NgxExport.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE TemplateHaskell, ForeignFunctionInterface, InterruptibleFFI #-}-{-# LANGUAGE ViewPatterns, PatternSynonyms #-}+{-# LANGUAGE ViewPatterns, PatternSynonyms, TupleSections #-} ----------------------------------------------------------------------------- -- |@@ -21,6 +21,7 @@ ContentHandlerResult ,UnsafeContentHandlerResult -- * Exporters+ -- *** Synchronous handlers ,ngxExportSS ,ngxExportSSS ,ngxExportSLS@@ -30,23 +31,27 @@ ,ngxExportYY ,ngxExportBY ,ngxExportIOYY+ -- *** Asynchronous handlers and services ,ngxExportAsyncIOYY ,ngxExportAsyncOnReqBody ,ngxExportServiceIOYY+ -- *** Content handlers ,ngxExportHandler ,ngxExportDefHandler ,ngxExportUnsafeHandler ,ngxExportAsyncHandler ,ngxExportAsyncHandlerOnReqBody+ -- *** Service hooks ,ngxExportServiceHook -- * Opaque pointers to Nginx global objects ,ngxCyclePtr ,ngxUpstreamMainConfPtr ,ngxCachedTimePtr- -- * Re-exported data constructors from /"Foreign.C"/+ -- * Re-exported data constructors from /Foreign.C/ -- (for marshalling in foreign calls) ,Foreign.C.CInt (..)- ,Foreign.C.CUInt (..)) where+ ,Foreign.C.CUInt (..)+ ) where import Language.Haskell.TH import Foreign.C@@ -105,15 +110,14 @@ {-# COMPLETE ToBool :: CUInt #-} #endif --- | The first element of the /3-tuple/ is /content/, the second is--- /content type/, and the third is /HTTP status/.+-- | The /3-tuple/ contains /(content, content-type, HTTP-status)/. type ContentHandlerResult = (L.ByteString, B.ByteString, Int) --- | The first element of the /3-tuple/ is /content/, the second is--- /content type/, and the third is /HTTP status/. Both the content and the--- content type are supposed to be referring to low-level string literals which--- do not need to be freed upon request termination and must not be--- garbage-collected in the Haskell RTS.+-- | The /3-tuple/ contains /(content, content-type, HTTP-status)/.+--+-- Both the /content/ and the /content-type/ are supposed to be referring to+-- low-level string literals that do not need to be freed upon an HTTP request+-- termination and must not be garbage-collected in the Haskell RTS. type UnsafeContentHandlerResult = (B.ByteString, B.ByteString, Int) data NgxExport = SS (String -> String)@@ -326,7 +330,8 @@ -- 'B.ByteString' -> 'Bool' -> 'IO' 'L.ByteString' -- @ ----- for using in directive __/haskell_run_service/__.+-- for using in directives __/haskell_run_service/__ and+-- __/haskell_service_var_update_callback/__. -- -- The boolean argument of the exported function marks that the service is -- being run for the first time.@@ -420,7 +425,8 @@ -- 'B.ByteString' -> 'IO' 'L.ByteString' -- @ ----- for using in directive __/haskell_service_hook/__.+-- for using in directives __/haskell_service_hook/__ and+-- __/haskell_service_update_hook/__. ngxExportServiceHook :: Name -> Q [Dec] ngxExportServiceHook = ngxExportC 'IOYY 'ioyYWithFree@@ -500,7 +506,7 @@ t <- safeMallocBytes $ n * sizeOf (undefined :: NgxStrType) if t == nullPtr then return (nullPtr, -1)- else (,) t <$>+ else (t, ) <$> L.foldlChunks (\a c -> do off <- a@@ -599,7 +605,7 @@ yY f x (I n) p pl spd = do (s, (r, _)) <- safeYYHandler $ do s <- f <$> B.unsafePackCStringLen (x, n)- fmap (flip (,) (0, False)) $ return $!! s+ fmap (, (0, False)) $ return $!! s pokeLazyByteString s p pl spd return r @@ -610,7 +616,7 @@ ioyYCommon pack f x (I n) p pl spd = do (s, (r, _)) <- safeYYHandler $ do s <- pack (x, n) >>= flip f False- fmap (flip (,) (0, False)) $ return $!! s+ fmap (, (0, False)) $ return $!! s pokeLazyByteString s p pl spd return r @@ -638,7 +644,7 @@ (do (s, (r, exiting)) <- safeYYHandler $ do (s, exiting) <- a- fmap (flip (,) (0, exiting)) $ return $!! s+ fmap (, (0, exiting)) $ return $!! s pokeLazyByteString s p pl spd poke pr r if exiting@@ -683,8 +689,8 @@ return (True, False) ) `catches`- [E.Handler $ return . flip (,) False . not . isEINTR- ,E.Handler $ return . (,) True . (== ThreadKilled)+ [E.Handler $ return . (, False) . not . isEINTR+ ,E.Handler $ return . (True, ) . (== ThreadKilled) ] else return False if exiting@@ -692,7 +698,7 @@ else do when fstRun $ poke active 1 x' <- B.unsafePackCStringLen (x, n)- flip (,) False <$> f x' fstRun+ (, False) <$> f x' fstRun ) fd efd asyncIOYYY :: IOYYY -> Ptr NgxStrType -> Ptr NgxStrType -> CInt ->@@ -703,7 +709,7 @@ (do b' <- peekRequestBodyChunks tmpf b m x' <- B.unsafePackCStringLen (x, n)- flip (,) False <$> f b' x'+ (, False) <$> f b' x' ) fd efd asyncHandler :: AsyncHandler -> CString -> CInt ->@@ -876,7 +882,7 @@ -- -- (value of expression ----- > ngx_http_cycle_get_module_main_conf(cycle, ngx_http_upstream_module))+-- > ngx_http_cycle_get_module_main_conf(cycle, ngx_http_upstream_module) -- -- in the worker's initialization function). ngxUpstreamMainConfPtr :: IO (Ptr ())
ngx-export.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-version: 1.4.1+version: 1.4.2 synopsis: Helper module for Nginx haskell module description: Helper module for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>