]> git.kaiwu.me - nginx.git/commitdiff
Proper SSL shutdown handling.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 1 Sep 2011 13:49:36 +0000 (13:49 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 1 Sep 2011 13:49:36 +0000 (13:49 +0000)
If connection has unsent alerts, SSL_shutdown() tries to send them even
if SSL_set_shutdown(SSL_RECEIVED_SHUTDOWN|SSL_SENT_SHUTDOWN) was used.
This can be prevented by SSL_set_quiet_shutdown().  SSL_set_shutdown()
is required nevertheless to preserve session.

src/event/ngx_event_openssl.c

index bb689488a86204a9164c047cf2e29e1037a9b298..259b1d8f269afac09f409188c61301a20d74afa7 100644 (file)
@@ -1205,6 +1205,7 @@ ngx_ssl_shutdown(ngx_connection_t *c)
 
     if (c->timedout) {
         mode = SSL_RECEIVED_SHUTDOWN|SSL_SENT_SHUTDOWN;
+        SSL_set_quiet_shutdown(c->ssl->connection, 1);
 
     } else {
         mode = SSL_get_shutdown(c->ssl->connection);
@@ -1216,6 +1217,10 @@ ngx_ssl_shutdown(ngx_connection_t *c)
         if (c->ssl->no_send_shutdown) {
             mode |= SSL_SENT_SHUTDOWN;
         }
+
+        if (c->ssl->no_wait_shutdown && c->ssl->no_send_shutdown) {
+            SSL_set_quiet_shutdown(c->ssl->connection, 1);
+        }
     }
 
     SSL_set_shutdown(c->ssl->connection, mode);