Helper module for Nginx haskell module

Latest on Hackage:1.4.1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed and maintained by Alexey Radkov

Helper module for Nginx haskell module



  • Corrected type of ngxCachedTimePtr.


  • Added a number of opaque pointers to Nginx global objects for using them in C plugins.


  • Export function ngxExportInstallSignalHandler to ignore SIGINT.


  • Returning a special error code (2) on exception ServiceHookInterrupt.


  • Bugfix: put unsigned integers in event channels (important for eventfd).


  • Added exporter ngxExportServiceHook for service hooks and exception ServiceHookInterrupt for interrupting services.


  • Added an asynchronous content handler with direct access to request body chunks exported with ngxExportAsyncHandlerOnReqBody.
  • Reading buffered request body from a temporary file when it's provided.


  • Using deepseq for really deep evaluation of resulting lazy bytestrings to prevent leaks of exceptions outside of protected code.


  • Added an asynchronous content handler exported with ngxExportAsyncHandler.
  • Content type in all content handlers gets packed in a strict bytestring now, which allows for using static strings without dynamic memory allocation.
  • Package stability tag was promoted to stable.

  • yY handler must be strict against exceptions in safeYYHandler.

  • Do not write into service event channel when Nginx is exiting.

  • Using interruptible FFI for safeWaitToSetLock to re-enable graceful shutdown with hs_exit() for shared services.

  • Function waitSetToLock from package unix calls C fcntl() unsafely which caused hangs of the whole haskell RTS when it was waiting for lock release. So this functions was reimplemented using safe semantics as safeWaitToSetLock.
  • Exported function ngxExportReleaseLockedByteString was removed because Nginx can call hsfreestable_ptr() directly.

  • A better solution for ghc warnings set.

  • Removed constraint on template-haskell via a CPP macro (this should repair compilation for ghc-7.10).

  • Implemented shared services using waitToSetLock to get exclusive access for servicing.
  • New dependency on package monad-loops (>= 0.4.2).

Further optimizations.

  • Poke single-chunked lazy bytestrings directly into passed from Nginx buffers.
  • Specialize polymorphic functions and inline trivial functions.

  • Added -Wno-incomplete-patterns in ghc-options for older ghc versions.

  • Constructors of NgxExport were lifted to type level for all handlers to mitigate warnings on incomplete patterns.
  • COMPLETE pragmas for pattern synonyms were added for the same reason.
  • Other warnings were fixed too. Now the module builds with ghc-options -Wall -Wno-unrecognised-pragmas.

  • Lazy bytestrings contents are no longer copied when passed back to Nginx. Instead, they are passed directly along with a StablePtr to original bytestrings. This must improve performance and lower memory consumption for content handlers with large outputs.

  • All synchronous variable and content handlers were made exception safe.
  • Bugfix: evaluate results of IO handlers strictly to make sure that all exceptions will be caught.

  • Bugfix: keep calling fdWriteBuf until it writes complete buffer.

  • All asynchronous handlers can now report events via eventfd channels.
  • New dependency on package binary (>=

  • Stricter constraints for packages base (>= 4.8 && < 5) and template-haskell (>=

  • Versioning security: get number of required version parts from C code.

  • Added versioning support to test for compatibility in C code.

  • Added an asynchronous client request body handler exported with ngxExportAsyncOnReqBody for using in a new Nginx directive haskellrunasynconrequest_body.

  • Added signatures for type-checkers and exporters to prevent warnings when reifying in a user code with -Wmissing-signatures or -Wall enabled.

  • Added a synchronous handler in IO Monad exported with ngxExportIOYY.

Used by 1 package:
comments powered byDisqus