Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 7811:1ebd78df4ce7
Fixed handling of already closed connections.
In limit_req, auth_delay, and upstream code to check for broken
connections, tests for possible connection close by the client
did not work if the connection was already closed when relevant
event handler was set. This happened because there were no additional
events in case of edge-triggered event methods, and read events
were disabled in case of level-triggered ones.
Fix is to explicitly post a read event if the c->read->ready flag
is set.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 28 Mar 2021 17:45:39 +0300 |
parents | 1bf8ab7063de |
children | 3ab8e1e2f0f7 5d09596909c6 f1986657fc26 |
comparison
equal
deleted
inserted
replaced
7810:1bf8ab7063de | 7811:1ebd78df4ce7 |
---|---|
606 | 606 |
607 u->store = u->conf->store; | 607 u->store = u->conf->store; |
608 | 608 |
609 if (!u->store && !r->post_action && !u->conf->ignore_client_abort) { | 609 if (!u->store && !r->post_action && !u->conf->ignore_client_abort) { |
610 | 610 |
611 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) { | 611 if (r->connection->read->ready) { |
612 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 612 ngx_post_event(r->connection->read, &ngx_posted_events); |
613 return; | 613 |
614 } else { | |
615 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) { | |
616 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
617 return; | |
618 } | |
614 } | 619 } |
615 | 620 |
616 r->read_event_handler = ngx_http_upstream_rd_check_broken_connection; | 621 r->read_event_handler = ngx_http_upstream_rd_check_broken_connection; |
617 r->write_event_handler = ngx_http_upstream_wr_check_broken_connection; | 622 r->write_event_handler = ngx_http_upstream_wr_check_broken_connection; |
618 } | 623 } |