comparison src/event/ngx_event_pipe.c @ 7581:afceb32f3a8a

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 17 Oct 2019 16:02:03 +0300
parents a5d1b1383dea
children bffcc5af1d72
comparison
equal deleted inserted replaced
7580:8f55cb5c7e79 7581:afceb32f3a8a
170 * This test allows not to allocate a buf on these conditions 170 * This test allows not to allocate a buf on these conditions
171 * and not to call c->recv_chain(). 171 * and not to call c->recv_chain().
172 */ 172 */
173 173
174 if (p->upstream->read->available == 0 174 if (p->upstream->read->available == 0
175 && p->upstream->read->pending_eof) 175 && p->upstream->read->pending_eof
176 #if (NGX_SSL)
177 && !p->upstream->ssl
178 #endif
179 )
176 { 180 {
177 p->upstream->read->ready = 0; 181 p->upstream->read->ready = 0;
178 p->upstream->read->eof = 1; 182 p->upstream->read->eof = 1;
179 p->upstream_eof = 1; 183 p->upstream_eof = 1;
180 p->read = 1; 184 p->read = 1;