view README @ 1:7c2d64d9c656

Working delay body and tests. Depends on rb->filter_need_buffering and rb->buffered, as well as corresponding changes in the request body reading code to work. Might not be the best solution, as current body reading code relies on rb->buffered to be properly set at various stages. Notably, rb->buffered must be cleared when calling the next filter, since the save body filter relies on it. Possible future improvements: implement last buffer checking in the save body filter instead of checking for (rb->rest == 0 && !rb->buffered). The code uses its own event to implement delay timer. To remove the timer in case of abnormal request termination a cleanup handler is added. While in theory it is possible to use a timer on c->read instead, this implies additional changes to the request body reading code. Custom event was chosen to reduce complexity of changes needed.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 20 Aug 2021 22:35:05 +0300
parents a386f95c5ae9
children
line wrap: on
line source

Delay body filter module for nginx.

This is a test module, to check request body filters buffering
mechanism to be introduced.

Example:

    location / {
        delay_body 1s;
    }

The module will delay the request body processing for the configured time.

To compile nginx with the delay body module, use the "--add-module <path>"
option of nginx configure.