[nginx] Upstream: SSL handshake timeouts.

Maxim Dounin mdounin at mdounin.ru
Mon Jul 28 14:31:36 UTC 2014


details:   http://hg.nginx.org/nginx/rev/9bf58a3da25b
branches:  
changeset: 5774:9bf58a3da25b
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon Jul 28 18:30:14 2014 +0400
description:
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.

diffstat:

 src/http/ngx_http_upstream.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

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
@@ -1393,6 +1393,11 @@ ngx_http_upstream_ssl_init_connection(ng
     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;
     }



More information about the nginx-devel mailing list