<div dir="auto">Fyck off</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 25 Sep 2023 at 15:22, Roman Arutyunyan <<a href="mailto:arut@nginx.com">arut@nginx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Andrey,<br>
<br>
On Sun, Sep 24, 2023 at 02:30:14PM +0300, Andrey Kulikov wrote:<br>
> Hello,<br>
> <br>
> Sometimes custom module developers need to iterate over configured<br>
> location(s), configured in some or all server(s) blocks.<br>
> For example, to perform post-initialization steps, defined by custom<br>
> directives in their modules.<br>
> Now it is virtually impossible.<br>
> <br>
> I've posted question about this matter few years ago:<br>
> <a href="https://mailman.nginx.org/pipermail/nginx-devel/2016-October/008882.html" rel="noreferrer" target="_blank">https://mailman.nginx.org/pipermail/nginx-devel/2016-October/008882.html</a><br>
> <br>
> Since then, I received quite a few private emails about whether I succeeded<br>
> in my findings.<br>
> So, I'm not alone, who faced this issue.<br>
<br>
You can iterate over locations in a server block using "locations" queue in<br>
ngx_http_core_loc_conf_t. You need to use the location configuration at<br>
the server level to access the queue. Referencing the example from your last<br>
email, it should be something like this:<br>
<br>
clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];<br>
<br>
/* iterate over clcf->locations */<br>
<br>
See ngx_http_core_location() as an example of how this queue is filled and<br>
ngx_http_merge_locations() as an example of how to iterate over it.<br>
<br>
> Fortunately, the described goal could be easily achieved by making just<br>
> internal proxy modules structures available in a separate header.<br>
> After that implementation of desired functionality is just a matter of<br>
> writing a few lines of code.<br>
<br>
Accessing proxy module to iterate over locations does not sound like the<br>
right decision.<br>
<br>
> Patches а following.<br>
> No functional changes, just code movement from .c to .h files.<br>
> <br>
> Development community, at least through my voice, will be grateful to see<br>
> them applied to the latest development branch.<br>
> <br>
> --<br>
> Cheers,<br>
> Andrey<br>
<br>
--<br>
Roman Arutyunyan<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="https://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote></div></div>