[nginx] SSL: added check for debugging.

Maxim Dounin mdounin at mdounin.ru
Sat Feb 20 16:21:35 UTC 2021


details:   https://hg.nginx.org/nginx/rev/51e6a665523c
branches:  
changeset: 7781:51e6a665523c
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Sat Feb 20 18:03:04 2021 +0300
description:
SSL: added check for debugging.

If debugging is not enabled, there is no need to do extra work in
ngx_ssl_verify_callback() and ngx_ssl_handshake_log().

diffstat:

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

diffs (25 lines):

diff -r 3bed5797a1b7 -r 51e6a665523c src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c	Sat Feb 20 18:02:54 2021 +0300
+++ b/src/event/ngx_event_openssl.c	Sat Feb 20 18:03:04 2021 +0300
@@ -1014,6 +1014,10 @@ ngx_ssl_verify_callback(int ok, X509_STO
 
     c = ngx_ssl_get_connection(ssl_conn);
 
+    if (!(c->log->log_level & NGX_LOG_DEBUG_EVENT)) {
+        return 1;
+    }
+
     cert = X509_STORE_CTX_get_current_cert(x509_store);
     err = X509_STORE_CTX_get_error(x509_store);
     depth = X509_STORE_CTX_get_error_depth(x509_store);
@@ -1970,6 +1974,10 @@ ngx_ssl_handshake_log(ngx_connection_t *
 #endif
     SSL_CIPHER  *cipher;
 
+    if (!(c->log->log_level & NGX_LOG_DEBUG_EVENT)) {
+        return;
+    }
+
     cipher = SSL_get_current_cipher(c->ssl->connection);
 
     if (cipher) {


More information about the nginx-devel mailing list