From 4b2f12a60485661039bad8e334716eba7fbc7b24 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Mon, 28 Jul 2014 18:30:14 +0400 Subject: [PATCH] Upstream: SSL handshake timeouts. Timeout may not be set on an upstream connection when we call ngx_ssl_handshake() in ngx_http_upstream_ssl_init_connection(), so make sure to arm it if it's not set. Based on a patch by Yichun Zhang. --- src/http/ngx_http_upstream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 58edc62fd..18b04f775 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1393,6 +1393,11 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r, rc = ngx_ssl_handshake(c); if (rc == NGX_AGAIN) { + + if (!c->write->timer_set) { + ngx_add_timer(c->write, u->conf->connect_timeout); + } + c->ssl->handler = ngx_http_upstream_ssl_handshake; return; }