question on module user context

Maxim Dounin mdounin at mdounin.ru
Sat Apr 11 23:43:57 MSD 2009


Hello!

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

> 2009/4/11 Maxim Dounin <mdounin at mdounin.ru>
> 
> > Hello!
> >
> > On Sat, Apr 11, 2009 at 11:04:14PM +0800, Delta Yeh 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.
> >
> 
> 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 Dounin





More information about the nginx mailing list