diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-01-14 08:02:51 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-01-14 08:02:51 +0100 |
commit | cced4fae9d424c3d715244c301b2f124f894fa8d (patch) | |
tree | eaa0c4151ea20f706f6df333824986244b005ab9 /src | |
parent | 5ec8a62f0528702a92a1db4fdee7a1c99187dc2e (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/IO/tls_openssl.c | 18 |
1 files changed, 16 insertions, 2 deletions
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(); |