Question on module user context


#1

Hi ,
If I set a context to a module with ngx_http_set_ctx(r, c, module)
Is this context valid only for current http request?
Should I set the context for each new http request?

BR,
DeltaY


#2

Hello!

On Sat, Apr 11, 2009 at 11:04:14PM +0800, Delta Y. wrote:

Hi ,
If I set a context to a module with ngx_http_set_ctx(r, c, module)
Is this context valid only for current http request?

Yes.

Should I set the context for each new http request?

No, only for requests where you actually need context.

Maxim D.


#3

2009/4/11 Maxim D. removed_email_address@domain.invalid

Should I set the context for each new http request?

No, only for requests where you actually need context.

So the context is used for the scenario that the handler callback will
be
called multiple times to process the http request ?


#4

Hello!

On Sat, Apr 11, 2009 at 11:33:22PM +0800, Delta Y. wrote:

Yes.

Should I set the context for each new http request?

No, only for requests where you actually need context.

So the context is used for the scenario that the handler callback will be
called multiple times to process the http request ?

Yes, it’s used to preserve some request-related state between
invocations of your module code.

Maxim D.