]> git.kaiwu.me - nginx.git/commitdiff
SSL: added check for debugging.
authorMaxim Dounin <mdounin@mdounin.ru>
Sat, 20 Feb 2021 15:03:04 +0000 (18:03 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Sat, 20 Feb 2021 15:03:04 +0000 (18:03 +0300)
If debugging is not enabled, there is no need to do extra work in
ngx_ssl_verify_callback() and ngx_ssl_handshake_log().

src/event/ngx_event_openssl.c

index 48b3192b1a82b12189170f2710f05010bdecb760..d762d6b7f26b49b604e6794496948c45af67ca65 100644 (file)
@@ -1014,6 +1014,10 @@ ngx_ssl_verify_callback(int ok, X509_STORE_CTX *x509_store)
 
     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 *c)
 #endif
     SSL_CIPHER  *cipher;
 
+    if (!(c->log->log_level & NGX_LOG_DEBUG_EVENT)) {
+        return;
+    }
+
     cipher = SSL_get_current_cipher(c->ssl->connection);
 
     if (cipher) {