"index off;" directive?

Maxim Dounin mdounin at mdounin.ru
Wed May 13 14:05:15 UTC 2026


Hello!

On Wed, May 13, 2026 at 10:00:29AM -0300, Fabiano Furtado wrote:

> On Tue, May 12, 2026 at 7:24 PM Maxim Dounin wrote:
> >
> > Hello!
> >
> > [...]
> >
> > Using "off" as an index file is certainly possible with both
> > variants, it just needs to be written as "./off" in some cases
> > (always with the loop checks, and when it's the only argument
> > otherwise).
> 
> OK!
> 
> > So I believe the main difference here is how well the behaviour
> > matches user expectations, most notably based on the syntax
> > provided.
> 
> Agreed!
> 
> > Committed, thanks for prodding this.
> 
> Thank you for accepting my idea and developing the patch! This is my
> first contribution to open-source software! :)

Congratulations! :)

> Yet, I have one doubt, specifically at the end of the function
> ngx_http_index_merge_loc_conf().
> 
> [...]
>         conf->max_index_len = sizeof(NGX_HTTP_DEFAULT_INDEX);
> 
>         return NGX_CONF_OK;  /* Line 435 */
>     }
> 
>     return NGX_CONF_OK;  /* Line 438 */
> }
> 
> There are two "return" statements with the same parameter: lines 435 and 438.
> 
> At line 435, do we really need this "return" statement, or is it
> required to comply with the guidelines from
> https://freenginx.org/en/docs/contributing_changes.html ?

Certainly the first return is not needed here, at least with the 
existing code.  No coding style rules require two returns here, 
but they still can appear for various reasons - for example, when 
two distinct returns are better from readability point of view, 
notably when some additional code might appear after the "if" block 
and this code is not expected to be executed when "if" matches.

My best guess is that it is a leftover from the previously used 
code structure, where there was some proof-of-concept additional 
code after the "no indices defined" if block (and this code wasn't 
expected to be executed without user-defined indices):

https://freenginx.org/hg/nginx/rev/9b8c906f6e63#l63.677

Still, it might be intentionally left this way (e.g., assuming 
that some code for user-defined indices will be added later).

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list