openssl: improve error message for SYSCALL during connect

Reported-by: Paulo Roberto Tomasi
Bug: https://curl.haxx.se/mail/archive-2019-11/0005.html

Closes https://github.com/curl/curl/pull/4593
This commit is contained in:
Daniel Stenberg 2019-11-14 14:19:04 +01:00 committed by Jay Satiro
parent 74f441c6d3
commit 1f4e7dc661
1 changed files with 6 additions and 1 deletions

View File

@ -2990,8 +2990,13 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
const char * const hostname = SSL_IS_PROXY() ?
conn->http_proxy.host.name : conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
char extramsg[80]="";
int sockerr = SOCKERRNO;
if(sockerr && detail == SSL_ERROR_SYSCALL)
Curl_strerror(sockerr, extramsg, sizeof(extramsg));
failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%ld ",
SSL_ERROR_to_str(detail), hostname, port);
extramsg[0] ? extramsg : SSL_ERROR_to_str(detail),
hostname, port);
return result;
}