Klaus Demo nginx / 96e4e84
Perl: fixed delaying subrequests. Much like in limit_req, use the wev->delayed flag to ensure proper handling and interoperability with limit_rate. Maxim Dounin 3 years ago
2 changed file(s) with 11 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
10001000
10011001 ctx->next = SvRV(ST(2));
10021002
1003 r->connection->write->delayed = 1;
10031004 ngx_add_timer(r->connection->write, sleep);
10041005
10051006 r->write_event_handler = ngx_http_perl_sleep_handler;
277277
278278 wev = r->connection->write;
279279
280 if (wev->timedout) {
281 wev->timedout = 0;
282 ngx_http_perl_handle_request(r);
280 if (wev->delayed && !wev->timedout) {
281
282 if (ngx_handle_write_event(wev, 0) != NGX_OK) {
283 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
284 }
285
283286 return;
284287 }
285288
286 if (ngx_handle_write_event(wev, 0) != NGX_OK) {
287 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
288 }
289 wev->delayed = 0;
290 wev->timedout = 0;
291
292 ngx_http_perl_handle_request(r);
289293 }
290294
291295