About the phase handlers init
Jinhua Luo
luajit.io at gmail.com
Fri Sep 3 04:08:32 UTC 2021
Hi, All.
In the function ngx_http_init_phase_handlers, I found two places hard
to understand.
a) The n variable is as known as the next phase handler index. In the
switch case NGX_HTTP_ACCESS_PHASE, it invokes n++, which seems to be
redundant and wrong, While in switch case NGX_HTTP_POST_ACCESS_PHASE,
it lacks n++. Think about that if the number of modules registers as
NGX_HTTP_ACCESS_PHASE is 0, then the next index is 1 more than the
correct number. Of course, the current codes have at least one
NGX_HTTP_POST_ACCESS_PHASE module: ngx_http_access_module, but it
contains the codes to jump to the next phase handler, then the jump
target is bypass NGX_HTTP_POST_ACCESS_PHASE and to
NGX_HTTP_PRECONTENT_PHASE?
b) Does the handler runs in reverse order of registration order?
for (j = cmcf->phases[i].handlers.nelts - 1; j >= 0; j--)
Please help, thanks.
More information about the nginx-devel
mailing list