rustls: handle EOF during initial handshake

Closes #21242
This commit is contained in:
kpcyrd 2026-04-06 18:45:19 +02:00 committed by Daniel Stenberg
parent a5542c23e7
commit ce05754c7c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1138,6 +1138,7 @@ static CURLcode cr_connect(struct Curl_cfilter *cf, struct Curl_easy *data,
CURLcode result;
bool wants_read;
bool wants_write;
ssize_t nread;
DEBUGASSERT(backend);
@ -1280,7 +1281,13 @@ static CURLcode cr_connect(struct Curl_cfilter *cf, struct Curl_easy *data,
if(wants_read) {
CURL_TRC_CF(data, cf, "rustls_connection wants us to read_tls.");
if(tls_recv_more(cf, data, &tmperr) < 0) {
nread = tls_recv_more(cf, data, &tmperr);
if(nread == 0) {
connssl->peer_closed = TRUE;
failf(data, "TLS connect error: Connection closed abruptly");
return CURLE_SSL_CONNECT_ERROR;
}
if(nread < 0) {
if(tmperr == CURLE_AGAIN) {
CURL_TRC_CF(data, cf, "reading would block");
connssl->io_need = CURL_SSL_IO_NEED_RECV;