Welcome! Log In Create A New Profile


Request Counter Clarification

December 21, 2020 09:56AM
Dear NGINX community,

I am developing an NGINX module which would check the contents of the
request and if the key components found, would block it. Currently, it
seems to be working correctly, but I would like to clarify some parts and
make sure that I am not hard-coding anything. So, the question is mainly
about the request counter.
During the execution of the request handler (which is registered on the
HTTP_REWRITE_PHASE), the request counter is kept as it is. But once the
handler finishes the request processing, the counter is changed to 1. But
changing the counter to 1 does not seem like a right decision, as many
other modules more often decrease it in the post_handler or call the
"finalize request" function. However, the use of "finalize" cannot be
implemented, as neither connection, nor request should not be finalized
after the handler execution. Instead, the request needs to be handed over
to the other phase handlers (return NGX_DECLINED). As for the decrementing
in the post_handler of the ngx_http_read_client_request_body function, on
the heavy loads, it results in the segfaults. Finally, leaving the counter
unchanged throughout the process leads to memory leaks. Therefore, the
above-described value assignment was implemented, but, perhaps, there are
better ways of handling the request counter issue? And why the change in
the request counter can cause a segfault in the first place?

With best regards,
nginx-devel mailing list
Subject Author Views Posted

Request Counter Clarification

M L 129 December 21, 2020 09:56AM

Re: Request Counter Clarification

Maxim Dounin 20 December 25, 2020 09:48AM

Re: Request Counter Clarification

M L 8 January 16, 2021 12:14PM

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

Online Users

Guests: 54
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready