Forum: NGINX question on module user context

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6d4a6e9574c15d11480db6d7e5eb2750?d=identicon&s=25 Delta Yeh (Guest)
on 2009-04-11 17:12
(Received via mailing list)
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
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2009-04-11 17:28
(Received via mailing list)
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.

Maxim Dounin
6d4a6e9574c15d11480db6d7e5eb2750?d=identicon&s=25 Delta Yeh (Guest)
on 2009-04-11 17:41
(Received via mailing list)
2009/4/11 Maxim Dounin <mdounin@mdounin.ru>

> > 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 ?
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2009-04-11 21:58
(Received via mailing list)
Hello!

On Sat, Apr 11, 2009 at 11:33:22PM +0800, Delta Yeh 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 Dounin
This topic is locked and can not be replied to.