Best place to store per-request state ?

Ruslan Ermilov ru at nginx.com
Wed Mar 4 08:29:14 UTC 2015


On Tue, Mar 03, 2015 at 10:56:55PM -0800, James Gan wrote:
> I'm learning how to develop module for nginx.
> 
> In one of my testing module, I'm trying to save several per-request
> int/long states for each http request in my  module. The easiest approach
> seems to add these variables to ngx_http_request_s struct. Though I don't
> really want to modify core modules.
> 
> Is there a recommended approach for saving per-request state without
> modifying core http modules?
> 
> Thanks a lot!

See ngx_http_set_ctx() and ngx_http_get_module_ctx().



More information about the nginx-devel mailing list