aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-01-14 08:02:51 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-01-14 08:02:51 +0100
commitcced4fae9d424c3d715244c301b2f124f894fa8d (patch)
treeeaa0c4151ea20f706f6df333824986244b005ab9
parent5ec8a62f0528702a92a1db4fdee7a1c99187dc2e (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.
-rw-r--r--src/IO/tls_openssl.c18
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();