ngx_http_set_ctx

Maxim Dounin mdounin at mdounin.ru
Fri Dec 23 13:55:17 UTC 2011


Hello!

On Thu, Dec 22, 2011 at 04:51:49PM -0500, J.Q. S. wrote:

> Could someone please explain what the ngx_http_set_ctx macro is doing and
> when it should be used?

It sets pointer to a module context structure within request.  It 
is expected to be used when module needs to preserve some 
information between different invocations within the same request.
It's commonly used by filter modules, see e.g. 
src/http/modules/ngx_http_sub_filter_module.c.

> A related question, are patches that add documentation to the code welcome?
> Or are we trying to keep comments out of the code?

Not really.  We prefer to comment only non-trivial aspects of the 
code.

Maxim Dounin



More information about the nginx-devel mailing list