From 64c7191237f9cd2ef8e41d0269202a6a111d0feb Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Wed, 6 Oct 2021 15:57:14 +0300 Subject: [PATCH] Fixed timeouts with Fetch, SSL and select. Similar to the connection hang fixed in 058a67435e83 in nginx, it is possible that an established connection is ready for reading after the handshake. Further, events might be already disabled in case of level-triggered event methods. Fix is to post a read event if the c->read->ready flag is set. --- nginx/ngx_js_fetch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nginx/ngx_js_fetch.c b/nginx/ngx_js_fetch.c index ce13b8ba..4795c877 100644 --- a/nginx/ngx_js_fetch.c +++ b/nginx/ngx_js_fetch.c @@ -1007,6 +1007,10 @@ ngx_js_http_ssl_handshake(ngx_js_http_t *http) c->write->handler = ngx_js_http_write_handler; c->read->handler = ngx_js_http_read_handler; + if (c->read->ready) { + ngx_post_event(c->read, &ngx_posted_events); + } + http->process = ngx_js_http_process_status_line; ngx_js_http_write_handler(c->write); -- 2.47.3