]> git.kaiwu.me - nginx.git/commitdiff
Upstream: SSL handshake timeouts.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 28 Jul 2014 14:30:14 +0000 (18:30 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 28 Jul 2014 14:30:14 +0000 (18:30 +0400)
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

index 58edc62fd1e359611ec38b4e4db9a53b80582796..18b04f775f0f14bb2dab0a908510d6f0d2f42048 100644 (file)
@@ -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;
     }