diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-05-31 22:33:07 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-01 21:12:51 +0200 |
commit | c8080eb22362630b7a735d30da55dd23779cd83c (patch) | |
tree | 25b13b31775fa38a19e35149d61e233b6110c0c7 | |
parent | dbe0c669409bb441a8464d0cd8a034c1a266f9e5 (diff) |
Handle SSL_ERROR_ZERO_RETURN in OpenSSL
It may be returned when the server closes the connection, see:
https://www.openssl.org/docs/manmaster/man3/SSL_get_error.html
We simply handle it as if there was no error and return zero bytes read.
Fixes: https://github.com/dillo-browser/dillo/issues/175
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/IO/tls_openssl.c | 3 |
2 files changed, 5 insertions, 0 deletions
@@ -11,6 +11,8 @@ dillo-3.1.1 [not released yet] +- Disable TLSv1.3 in Mbed TLS 3.6.0 until it is supported. - Add workaround for Cygwin and OpenSSL with --disable-threaded-dns. - Fix distcheck when HTML tests are enabled. + - Fix an OpenSSL bug when the server closes the connection prematurely and + SSL_get_error() returns SSL_ERROR_ZERO_RETURN. Patches: Rodrigo Arias Mallo <rodarima@gmail.com> +- Add HTML tests to the distributed tarball. Patches: Matt Jolly diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c index 90be78b7..3e53800d 100644 --- a/src/IO/tls_openssl.c +++ b/src/IO/tls_openssl.c @@ -1277,6 +1277,9 @@ static int Tls_handle_error(Conn_t *conn, int ret, const char *where) if (err1_ret == SSL_ERROR_NONE) { errno = 0; return ret; + } else if (err1_ret == SSL_ERROR_ZERO_RETURN) { + errno = 0; + return 0; } else if (err1_ret == SSL_ERROR_WANT_READ || err1_ret == SSL_ERROR_WANT_WRITE) { errno = EAGAIN; return -1; |