Welcome! Log In Create A New Profile

Advanced

request body filter last_buf

January 26, 2022 07:58PM
Hi,
in my module I am inspecting the request body and making certain
decisions such as sending a 403 based on the content in the body. I based
my implementation based on the examples in the documentation and other
nginx modules.

http://nginx.org/en/docs/dev/development_guide.html#http_request_body_filters

Sometimes, when my body_filter handler is invoked, I accumulate the body
into a single buffer for processing in my module. To do this, I have to
first get the length of the body. To get the length, I cycle through the
body buffer chain. I also look for the last_buf to be set for the last
buffer in the chain. The presence of the last_buf tells me that I have the
complete body. However, sometimes I've noticed that the last_buf flag is
not set (I log such requests), in which case I cannot process the body.

Under what conditions would the flag be not set when the body_filter
handler is invoked? Does the body filter handler get invoked multiple times
or only once? Is my assumption that the last_buf flag will always be set
when the body-filter handler is invoked correct? Any help is appreciated.

regards,
Dk
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

request body filter last_buf

dnj0496 200 January 26, 2022 07:58PM

Re: request body filter last_buf

Maxim Dounin 39 January 26, 2022 08:26PM

Re: request body filter last_buf

dnj0496 40 January 26, 2022 11:40PM

Re: request body filter last_buf

Maxim Dounin 50 January 27, 2022 08:30AM

Re: request body filter last_buf

dnj0496 43 January 27, 2022 02:06PM

Re: request body filter last_buf

Maxim Dounin 59 January 28, 2022 06:22PM



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

Online Users

Guests: 127
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