Proper TLS error handling

This commit is contained in:
2022-07-19 16:41:52 -05:00
parent 8c2f8441d1
commit 6b2e112f3b

View File

@@ -398,8 +398,12 @@ int updateConnection(Connection *conn, Sitefile *site) {
createFormatLog("Attempting to receive %ld bytes", sizeof buff);
received = recvStream(conn->stream, buff, sizeof buff);
createFormatLog("Received %ld bytes", received);
if (received < 0)
return errno != EAGAIN && totalReceived <= 0;
if (received < 0) {
if (conn->stream->type == TCP)
return errno != EAGAIN && totalReceived <= 0;
else
return received == GNUTLS_E_INVALID_SESSION;
}
if (received == 0)
return 1;
totalReceived += received;