From cced4fae9d424c3d715244c301b2f124f894fa8d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 14 Jan 2024 08:02:51 +0100 Subject: Report TLS errors if any before aborting Instead of just assert that there are no previous TLS errors, print the error queue and then abort. It prevents the error queue to be emptied before having a chance to see what error was stored. --- src/IO/tls_openssl.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c index 39343d3f..18367e64 100644 --- a/src/IO/tls_openssl.c +++ b/src/IO/tls_openssl.c @@ -1076,7 +1076,14 @@ static void Tls_connect(int fd, int connkey) return; } - assert(!ERR_get_error()); + if (ERR_peek_error()) { + unsigned long err; + while ((err = ERR_get_error())) { + MSG("Tls_connect: queued error: %s\n", + ERR_error_string(err, NULL)); + } + abort(); + } ret = SSL_connect(conn->ssl); @@ -1184,7 +1191,14 @@ void a_Tls_openssl_connect(int fd, const DilloUrl *url) success = FALSE; } - assert(!ERR_get_error()); + if (ERR_peek_error()) { + unsigned long err; + while ((err = ERR_get_error())) { + MSG("a_Tls_openssl_connect: queued error: %s\n", + ERR_error_string(err, NULL)); + } + abort(); + } if (success && !(ssl = SSL_new(ssl_context))) { unsigned long err_ret = ERR_get_error(); -- cgit v1.2.3