From d1ad6b5c250d0bc4c43b4d9983badf8ce01b5747 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 10 Jun 2021 16:32:29 +0200 Subject: [PATCH] Remove early data check for TLSInStream Having this early check means that we somewhat randomly get different exception behaviours on errors in deeper layers as some exceptions are allowed to propagate unhindered and some are not (since they are thrown in the pull function). --- common/rdr/TLSInStream.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index e6c9c906..94e6109b 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -93,17 +93,15 @@ size_t TLSInStream::readTLS(U8* buf, size_t len) { int n; - if (gnutls_record_check_pending(session) == 0) { - if (!in->hasData(1)) - return 0; - } - n = gnutls_record_recv(session, (void *) buf, len); if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN) return 0; if (n < 0) throw TLSException("readTLS", n); + if (n == 0) + throw EndOfStream(); + return n; } -- 2.39.5