[nginx] SSL: logging level of "peer closed connection in SSL han...

Maxim Dounin mdounin at mdounin.ru
Fri Jul 4 18:31:25 UTC 2014

details:   http://hg.nginx.org/nginx/rev/57c05ff57980
changeset: 5747:57c05ff57980
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Jul 04 22:14:36 2014 +0400
SSL: logging level of "peer closed connection in SSL handshake".

Previously, the NGX_LOG_INFO level was used unconditionally.  This is
correct for client SSL connections, but too low for connections to
upstream servers.  To resolve this, ngx_connection_error() now used
to log this error, it will select logging level appropriately.

With this change, if an upstream connection is closed during SSL
handshake, it is now properly logged at "error" level.


 src/event/ngx_event_openssl.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (14 lines):

diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -1112,8 +1112,8 @@ ngx_ssl_handshake(ngx_connection_t *c)
     c->read->eof = 1;
     if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) {
-        ngx_log_error(NGX_LOG_INFO, c->log, err,
-                      "peer closed connection in SSL handshake");
+        ngx_connection_error(c, err,
+                             "peer closed connection in SSL handshake");
         return NGX_ERROR;

More information about the nginx-devel mailing list