openssl: call SSL_get_error() with proper error

The error function should be called with the return code from the
previous call to SSL_shutdown() as argument.

Closes #18872
This commit is contained in:
Daniel Stenberg 2025-10-06 10:39:29 +02:00
parent db98daab05
commit e7a5184fa1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2169,14 +2169,16 @@ static CURLcode ossl_shutdown(struct Curl_cfilter *cf,
/* SSL should now have started the shutdown from our side. Since it
* was not complete, we are lacking the close notify from the server. */
if(send_shutdown && !(SSL_get_shutdown(octx->ssl) & SSL_SENT_SHUTDOWN)) {
int rc;
ERR_clear_error();
CURL_TRC_CF(data, cf, "send SSL close notify");
if(SSL_shutdown(octx->ssl) == 1) {
rc = SSL_shutdown(octx->ssl);
if(rc == 1) {
CURL_TRC_CF(data, cf, "SSL shutdown finished");
*done = TRUE;
goto out;
}
if(SSL_ERROR_WANT_WRITE == SSL_get_error(octx->ssl, nread)) {
if(SSL_ERROR_WANT_WRITE == SSL_get_error(octx->ssl, rc)) {
CURL_TRC_CF(data, cf, "SSL shutdown still wants to send");
connssl->io_need = CURL_SSL_IO_NEED_SEND;
goto out;