# HG changeset patch # User Maxim Dounin # Date 1711764375 -10800 # Node ID 41db21d1ca7c26a68d4115dc14398ab209ceff1a # Parent d9a52ebb9b0063d6d5bc8d525c88df5140a5c492 Upstream: improved c->read->ready flag handling. Previously, reading the upstream response headers did not check the c->read->ready flag. Now the flag is checked. This ensures that ev->available checks as introduced in 7583:efd71d49bde0 and 7584:9d2ad2fb4423 will be able to prevent reading from the socket when using event methods other than kqueue or epoll, and when using SSL. This might be important to avoid looping for a long time when working with fast upstream servers over protocols where large chunks of data can be skipped while reading response headers, notably FastCGI and gRPC. diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2437,7 +2437,12 @@ ngx_http_upstream_process_header(ngx_htt for ( ;; ) { - n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last); + if (c->read->ready) { + n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last); + + } else { + n = NGX_AGAIN; + } if (n == NGX_AGAIN) { #if 0