From 96e4e84ce273664d0ee43c5c5b7d14efa6f86d39 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Sun, 2 Apr 2017 14:32:28 +0300 Subject: Perl: fixed delaying subrequests. Much like in limit_req, use the wev->delayed flag to ensure proper handling and interoperability with limit_rate. --- src/http/modules/perl/ngx_http_perl_module.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/http/modules/perl/ngx_http_perl_module.c') diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c index 279631974..79ded0f2f 100644 --- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -278,15 +278,19 @@ ngx_http_perl_sleep_handler(ngx_http_request_t *r) wev = r->connection->write; - if (wev->timedout) { - wev->timedout = 0; - ngx_http_perl_handle_request(r); + if (wev->delayed && !wev->timedout) { + + if (ngx_handle_write_event(wev, 0) != NGX_OK) { + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + } + return; } - if (ngx_handle_write_event(wev, 0) != NGX_OK) { - ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); - } + wev->delayed = 0; + wev->timedout = 0; + + ngx_http_perl_handle_request(r); } -- cgit v1.2.3