Welcome! Log In Create A New Profile

Advanced

Re: [Proposal] Expose HTTP and Stream proxy modules structures for developers.

Roman Arutyunyan
September 25, 2023 10:24AM
Hello Andrey,

On Sun, Sep 24, 2023 at 02:30:14PM +0300, Andrey Kulikov wrote:
> Hello,
>
> Sometimes custom module developers need to iterate over configured
> location(s), configured in some or all server(s) blocks.
> For example, to perform post-initialization steps, defined by custom
> directives in their modules.
> Now it is virtually impossible.
>
> I've posted question about this matter few years ago:
> https://mailman.nginx.org/pipermail/nginx-devel/2016-October/008882.html
>
> Since then, I received quite a few private emails about whether I succeeded
> in my findings.
> So, I'm not alone, who faced this issue.

You can iterate over locations in a server block using "locations" queue in
ngx_http_core_loc_conf_t. You need to use the location configuration at
the server level to access the queue. Referencing the example from your last
email, it should be something like this:

clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];

/* iterate over clcf->locations */

See ngx_http_core_location() as an example of how this queue is filled and
ngx_http_merge_locations() as an example of how to iterate over it.

> Fortunately, the described goal could be easily achieved by making just
> internal proxy modules structures available in a separate header.
> After that implementation of desired functionality is just a matter of
> writing a few lines of code.

Accessing proxy module to iterate over locations does not sound like the
right decision.

> Patches а following.
> No functional changes, just code movement from .c to .h files.
>
> Development community, at least through my voice, will be grateful to see
> them applied to the latest development branch.
>
> --
> Cheers,
> Andrey

--
Roman Arutyunyan
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[Proposal] Expose HTTP and Stream proxy modules structures for developers.

Andrey Kulikov 396 September 24, 2023 07:32AM

Re: [Proposal] Expose HTTP and Stream proxy modules structures for developers.

Roman Arutyunyan 121 September 25, 2023 10:24AM

Re: [Proposal] Expose HTTP and Stream proxy modules structures for developers.

stewart dunn 140 September 25, 2023 10:28AM



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

Online Users

Guests: 155
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready