summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2022-09-11 10:45:16 -0400
committerGökay ŞATIR <gokaysatir@gmail.com>2022-09-19 17:37:01 +0300
commit846d5956e27df3c2398cb9bc819f210543b28234 (patch)
tree8dd713eedb9a917d3b09b9f7e1d4eb276c8ac5cb
parentcypress: use selectFromColorPicker which doesn't rely on generated id's (diff)
downloadonline-846d5956e27df3c2398cb9bc819f210543b28234.tar.gz
online-846d5956e27df3c2398cb9bc819f210543b28234.zip
wsd: improve SSL error reporting
ERR_get_error cleared the returned error, which meant the subsequent call to print the error in string form, using ERR_print_errors_cb, didn't find anything to report. Change-Id: If131a8cc0d2c1d8bbf705ed38f144b38abf6c8c6 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
-rw-r--r--net/SslSocket.hpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/SslSocket.hpp b/net/SslSocket.hpp
index aabd7dabf7..29503ea430 100644
--- a/net/SslSocket.hpp
+++ b/net/SslSocket.hpp
@@ -361,7 +361,7 @@ private:
LOG_TRC("SSL error: UNKNOWN (" << sslError << ") " << getBioError(rc));
// The error is coming from BIO. Find out what happened.
- const long bioError = ERR_get_error();
+ const long bioError = ERR_peek_error();
std::ostringstream oss;
oss << '#' << getFD();
@@ -385,9 +385,14 @@ private:
oss << ": unknown. ";
}
}
+ else
+ {
+ oss << ": unknown. ";
+ }
oss << getBioError(rc);
- std::string msg = oss.str();
+ const std::string msg = oss.str();
+ LOG_TRC("Throwing SSL Error: " << msg); // Locate the source of the exception.
errno = last_errno; // Restore errno.
throw std::runtime_error(msg);
}
@@ -401,7 +406,7 @@ private:
std::string getBioError(const int rc) const
{
// The error is coming from BIO. Find out what happened.
- const long bioError = ERR_get_error();
+ const long bioError = ERR_peek_error();
std::ostringstream oss;
oss << "BIO error: " << bioError << ", rc: " << rc;