Welcome! Log In Create A New Profile

Advanced

Re: internal redirect and module context

January 22, 2022 02:42PM
That is exactly what I needed. Thank you.

Dk.

On Sat, Jan 22, 2022 at 11:08 AM Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Sat, Jan 22, 2022 at 02:19:05AM -0800, Dk Jack wrote:
>
> > Maxim,
> > Thanks for responding to my query. I am passing the original context
> > pointer to the clean up handler. When my cleanup handler is called I am
> > retrieving the context pointer to clean up external resources. Based on
> > your response, the pointer saved in the cleanup handler should still be
> > valid and should be still safe to use and no memory/resources will be
> > leaked if I use that pointer to cleanup old allocations. This seems to be
> > in agreement with what I observed in my debugging.
>
> Yes, that's look correct. Note that if you create a new
> context with new resources, you have to add another cleanup
> handler to free these new resources as well.
>
> > A follow up question. After the redirect call, I am recreating the
> context
> > and restoring some of the data. However, like you mentioned I cannot
> > restore all the data. Currently, I am not accessing inaccessible data,
> > it seems to be working fine. However, in case I need to access the lost
> > data, is there another area in the request that is not disturbed by the
> > redirect call where I can save the context data?
>
> Cleanup handlers is the best way go, check the realip module and
> the ngx_http_realip_get_module_ctx() function I've mentioned in
> the previous message.
>
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx-devel mailing list -- nginx-devel@nginx.org
> To unsubscribe send an email to nginx-devel-leave@nginx.org
>
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

internal redirect and module context

dnj0496 437 January 21, 2022 07:10PM

Re: internal redirect and module context

Maxim Dounin 170 January 22, 2022 12:22AM

Re: internal redirect and module context

dnj0496 547 January 22, 2022 05:22AM

Re: internal redirect and module context

Maxim Dounin 182 January 22, 2022 02:10PM

Re: internal redirect and module context

dnj0496 270 January 22, 2022 02:42PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 260
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready