# HG changeset patch # User Maxim Dounin # Date 1571317323 -10800 # Node ID afceb32f3a8a231833f34b04032c6123e97bddf4 # Parent 8f55cb5c7e795e26c040a33c43e0074e5fddf63c Event pipe: disabled c->read->available checking for SSL. In SSL connections, data can be buffered by the SSL layer, and it is wrong to avoid doing c->recv_chain() if c->read->available is 0 and c->read->pending_eof is set. And tests show that the optimization in question indeed can result in incorrect detection of premature connection close if upstream closes the connection without sending a close notify alert at the same time. Fix is to disable c->read->available optimization for SSL connections. diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c --- a/src/event/ngx_event_pipe.c +++ b/src/event/ngx_event_pipe.c @@ -172,7 +172,11 @@ ngx_event_pipe_read_upstream(ngx_event_p */ if (p->upstream->read->available == 0 - && p->upstream->read->pending_eof) + && p->upstream->read->pending_eof +#if (NGX_SSL) + && !p->upstream->ssl +#endif + ) { p->upstream->read->ready = 0; p->upstream->read->eof = 1;