Description: Fix connection to HTTPS sites offering TLS 1.3 Author: Andreas Metzler Origin: https://lists.gnu.org/archive/html/lynx-dev/2018-12/msg00009.html --- a/src/tidy_tls.c +++ b/src/tidy_tls.c @@ -462,13 +462,25 @@ { int rc; - rc = (int) gnutls_record_recv(ssl->gnutls_state, buffer, (size_t) length); + do + { + rc = (int) gnutls_record_recv(ssl->gnutls_state, buffer, (size_t) length); + } + while ((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)); if (rc < 0 && gnutls_error_is_fatal(rc) == 0) { if (rc == GNUTLS_E_REHANDSHAKE) { (void) gnutls_handshake(ssl->gnutls_state); - gnutls_record_send(ssl->gnutls_state, ssl->sendbuffer, (size_t) ssl->bytes_sent); - rc = (int) gnutls_record_recv(ssl->gnutls_state, buffer, (size_t) length); + do + { + rc = (int) gnutls_record_send(ssl->gnutls_state, ssl->sendbuffer, (size_t) ssl->bytes_sent); + } + while ((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)); + do + { + rc = (int) gnutls_record_recv(ssl->gnutls_state, buffer, (size_t) length); + } + while ((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)); } } @@ -500,7 +512,11 @@ { int rc; - rc = (int) gnutls_record_send(ssl->gnutls_state, buffer, (size_t) length); + do + { + rc = (int) gnutls_record_send(ssl->gnutls_state, buffer, (size_t) length); + } + while ((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)); ssl->last_error = rc; if (rc < 0) {