diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-10-24 14:34:00 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-11-06 19:42:38 +0100 |
commit | 41eec4efa2a8c653973b25240c5cda81bb12e26f (patch) | |
tree | 955df9a5237e9f0ee318f2b5bcd0b9eca6e60f29 /lib | |
parent | 2045d83dd3f478f7bb8ef86959a82c96235b2bca (diff) |
gnutls: print alerts during handshake
Diffstat (limited to 'lib')
-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; } |