packages feed

ngx-export 1.6.2 → 1.6.3

raw patch · 4 files changed

+53/−11 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ NgxExport: FinalizeHTTPRequest :: Int -> Maybe String -> FinalizeHTTPRequest
+ NgxExport: RestartWorkerProcess :: String -> RestartWorkerProcess
+ NgxExport: data FinalizeHTTPRequest
+ NgxExport: instance GHC.Exception.Type.Exception NgxExport.FinalizeHTTPRequest
+ NgxExport: instance GHC.Exception.Type.Exception NgxExport.RestartWorkerProcess
+ NgxExport: instance GHC.Show.Show NgxExport.FinalizeHTTPRequest
+ NgxExport: instance GHC.Show.Show NgxExport.RestartWorkerProcess
+ NgxExport: newtype RestartWorkerProcess

Files

Changelog.md view
@@ -1,3 +1,7 @@+### 1.6.3++- Added API exceptions *RestartWorkerProcess* and *FinalizeHTTPRequest*.+ ### 1.6.2  - Added exception *TerminateWorkerProcess* that can be used for a little bit
LICENSE view
@@ -1,7 +1,7 @@ The following license covers this documentation, and the source code, except where otherwise indicated. -Copyright 2016-2018, Alexey Radkov. All rights reserved.+Copyright 2016-2019, Alexey Radkov. All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
NgxExport.hs view
@@ -4,7 +4,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  NgxExport--- Copyright   :  (c) Alexey Radkov 2016-2018+-- Copyright   :  (c) Alexey Radkov 2016-2019 -- License     :  BSD-style -- -- Maintainer  :  alexey.radkov@gmail.com@@ -47,8 +47,10 @@                  ,ngxCyclePtr                  ,ngxUpstreamMainConfPtr                  ,ngxCachedTimePtr-    -- * Exception /TerminateWorkerProcess/+    -- * Accessing Nginx core functionality from Haskell handlers                  ,TerminateWorkerProcess (..)+                 ,RestartWorkerProcess (..)+                 ,FinalizeHTTPRequest (..)     -- * Re-exported data constructors from /Foreign.C/     -- | Re-exports are needed by exporters for marshalling in foreign calls.                  ,Foreign.C.CInt (..)@@ -82,6 +84,7 @@ import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Char8 as C8L import           Data.Binary.Put+import           Data.Bits import           Paths_ngx_export (version) import           Data.Version @@ -484,11 +487,10 @@  -- | Terminates the worker process. ----- Being thrown from a service when that runs for the first time, this--- exception makes Nginx log the supplied message and terminate the worker--- process without respawning. This can be useful when the service is unable--- to read its configuration from the Nginx configuration script or to perform--- an important initialization action.+-- Being thrown from a service, this exception makes Nginx log the supplied+-- message and terminate the worker process without respawning. This can be+-- useful when the service is unable to read its configuration from the Nginx+-- configuration script or to perform an important initialization action. -- -- @since 1.6.2 newtype TerminateWorkerProcess =@@ -498,6 +500,35 @@ instance Show TerminateWorkerProcess where     show (TerminateWorkerProcess s) = s +-- | Restarts the worker process.+--+-- The same as 'TerminateWorkerProcess', except that a new worker process shall+-- be spawned by the Nginx master process in place of the current one.+--+-- @since 1.6.3+newtype RestartWorkerProcess =+    RestartWorkerProcess String  -- ^ Contains the message to log++instance Exception RestartWorkerProcess+instance Show RestartWorkerProcess where+    show (RestartWorkerProcess s) = s++-- | Finalizes the HTTP request.+--+-- Being thrown from an asynchronous variable handler, this exception makes+-- Nginx finalize the current HTTP request with the supplied HTTP status and+-- an optional body. If the body is /Nothing/ then the response will be styled+-- by the Nginx core.+--+-- @since 1.6.3+data FinalizeHTTPRequest =+    FinalizeHTTPRequest Int (Maybe String)  -- ^ Contains HTTP status and body++instance Exception FinalizeHTTPRequest+instance Show FinalizeHTTPRequest where+    show (FinalizeHTTPRequest _ (Just s)) = s+    show (FinalizeHTTPRequest _ Nothing) = ""+ safeMallocBytes :: Int -> IO (Ptr a) safeMallocBytes =     flip catchIOError (const $ return nullPtr) . mallocBytes@@ -604,7 +635,14 @@                 Just ServiceHookInterrupt -> 2                 _ -> case fromException e of                     Just (TerminateWorkerProcess _) -> 3-                    _ -> 1+                    _ -> case fromException e of+                        Just (RestartWorkerProcess _) -> 4+                        _ -> case fromException e of+                            Just (FinalizeHTTPRequest st (Just _)) ->+                                0x80000000 .|. fromIntegral st+                            Just (FinalizeHTTPRequest st Nothing) ->+                                0xC0000000 .|. fromIntegral st+                            _ -> 1             ,case asyncExceptionFromException e of                 Just ThreadKilled -> True                 _ -> False
ngx-export.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-version:                    1.6.2+version:                    1.6.3 synopsis:                   Helper module for Nginx haskell module description:                Helper module for         <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.@@ -10,7 +10,7 @@ author:                     Alexey Radkov <alexey.radkov@gmail.com> maintainer:                 Alexey Radkov <alexey.radkov@gmail.com> stability:                  stable-copyright:                  2016-2018 Alexey Radkov+copyright:                  2016-2019 Alexey Radkov category:                   Network build-type:                 Simple cabal-version:              1.20