Skip to content

Commit

Permalink
rustsls: fix error code on receive
Browse files Browse the repository at this point in the history
- use CURLE_RECV_ERROR instead of CURLE_READ_ERROR when receiving
  data fails.

Closes #13670
  • Loading branch information
icing authored and bagder committed May 16, 2024
1 parent c7b0fa4 commit df4a8c7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/vtls/rustls.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static CURLcode map_error(rustls_result r)
case RUSTLS_RESULT_NULL_PARAMETER:
return CURLE_BAD_FUNCTION_ARGUMENT;
default:
return CURLE_READ_ERROR;
return CURLE_RECV_ERROR;
}
}

Expand Down Expand Up @@ -150,7 +150,7 @@ static ssize_t tls_recv_more(struct Curl_cfilter *cf,
char buffer[STRERROR_LEN];
failf(data, "reading from socket: %s",
Curl_strerror(io_error, buffer, sizeof(buffer)));
*err = CURLE_READ_ERROR;
*err = CURLE_RECV_ERROR;
return -1;
}

Expand Down Expand Up @@ -220,7 +220,7 @@ cr_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
else if(rresult == RUSTLS_RESULT_UNEXPECTED_EOF) {
failf(data, "rustls: peer closed TCP connection "
"without first closing TLS connection");
*err = CURLE_READ_ERROR;
*err = CURLE_RECV_ERROR;
nread = -1;
goto out;
}
Expand All @@ -230,7 +230,7 @@ cr_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
size_t errorlen;
rustls_error(rresult, errorbuf, sizeof(errorbuf), &errorlen);
failf(data, "rustls_connection_read: %.*s", (int)errorlen, errorbuf);
*err = CURLE_READ_ERROR;
*err = CURLE_RECV_ERROR;
nread = -1;
goto out;
}
Expand Down Expand Up @@ -620,7 +620,7 @@ cr_connect_common(struct Curl_cfilter *cf,
infof(data, "reading would block");
/* fall through */
}
else if(tmperr == CURLE_READ_ERROR) {
else if(tmperr == CURLE_RECV_ERROR) {
return CURLE_SSL_CONNECT_ERROR;
}
else {
Expand Down

0 comments on commit df4a8c7

Please sign in to comment.