diff options
-rw-r--r-- | lib/gtls.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/gtls.c b/lib/gtls.c index dbf568c44..d8e88e2c4 100644 --- a/lib/gtls.c +++ b/lib/gtls.c @@ -304,10 +304,30 @@ static CURLcode handshake(struct connectdata *conn, return CURLE_OK; } else if((rc < 0) && !gnutls_error_is_fatal(rc)) { - failf(data, "gnutls_handshake() warning: %s", gnutls_strerror(rc)); + char *strerr = NULL; + + if(rc == GNUTLS_E_WARNING_ALERT_RECEIVED) { + int alert = gnutls_alert_get(session); + strerr = gnutls_alert_get_name(alert); + } + + if(strerr == NULL) + strerr = gnutls_strerror(rc); + + failf(data, "gnutls_handshake() warning: %s", strerr); } else if(rc < 0) { - failf(data, "gnutls_handshake() failed: %s", gnutls_strerror(rc)); + char *strerr = NULL; + + if(rc == GNUTLS_E_FATAL_ALERT_RECEIVED) { + int alert = gnutls_alert_get(session); + strerr = gnutls_alert_get_name(alert); + } + + if(strerr == NULL) + strerr = gnutls_strerror(rc); + + failf(data, "gnutls_handshake() failed: %s", strerr); return CURLE_SSL_CONNECT_ERROR; } |