mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -05:00
openssl: use strerror on SSL_ERROR_SYSCALL
Instead of showing the somewhat nonsensical errno number, use strerror() to provide a more relatable error message. Closes #4411
This commit is contained in:
parent
2078e7701b
commit
0ab38f5fd6
@ -44,6 +44,7 @@
|
|||||||
#include "strcase.h"
|
#include "strcase.h"
|
||||||
#include "hostcheck.h"
|
#include "hostcheck.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
|
#include "strerror.h"
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
@ -3825,8 +3826,8 @@ static ssize_t ossl_send(struct connectdata *conn,
|
|||||||
*curlcode = CURLE_AGAIN;
|
*curlcode = CURLE_AGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
case SSL_ERROR_SYSCALL:
|
case SSL_ERROR_SYSCALL:
|
||||||
failf(conn->data, "SSL_write() returned SYSCALL, errno = %d",
|
Curl_strerror(SOCKERRNO, error_buffer, sizeof(error_buffer));
|
||||||
SOCKERRNO);
|
failf(conn->data, OSSL_PACKAGE " SSL_write: %s", error_buffer);
|
||||||
*curlcode = CURLE_SEND_ERROR;
|
*curlcode = CURLE_SEND_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
case SSL_ERROR_SSL:
|
case SSL_ERROR_SSL:
|
||||||
@ -3893,6 +3894,11 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
|
|||||||
/* there's data pending, re-invoke SSL_read() */
|
/* there's data pending, re-invoke SSL_read() */
|
||||||
*curlcode = CURLE_AGAIN;
|
*curlcode = CURLE_AGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
|
case SSL_ERROR_SYSCALL:
|
||||||
|
Curl_strerror(SOCKERRNO, error_buffer, sizeof(error_buffer));
|
||||||
|
failf(conn->data, OSSL_PACKAGE " SSL_read: %s", error_buffer);
|
||||||
|
*curlcode = CURLE_RECV_ERROR;
|
||||||
|
return -1;
|
||||||
default:
|
default:
|
||||||
/* openssl/ssl.h for SSL_ERROR_SYSCALL says "look at error stack/return
|
/* openssl/ssl.h for SSL_ERROR_SYSCALL says "look at error stack/return
|
||||||
value/errno" */
|
value/errno" */
|
||||||
|
Loading…
Reference in New Issue
Block a user