mirror of https://github.com/moparisthebest/curl
openssl: fix SSL/TLS versions in verbose output
This commit is contained in:
parent
577286e0e2
commit
6dae798824
|
@ -1381,20 +1381,43 @@ static void ssl_tls_trace(int direction, int ssl_ver, int content_type,
|
||||||
struct SessionHandle *data;
|
struct SessionHandle *data;
|
||||||
const char *msg_name, *tls_rt_name;
|
const char *msg_name, *tls_rt_name;
|
||||||
char ssl_buf[1024];
|
char ssl_buf[1024];
|
||||||
int ver, msg_type, txt_len;
|
char unknown[32];
|
||||||
|
int msg_type, txt_len;
|
||||||
|
const char *verstr;
|
||||||
|
|
||||||
if(!conn || !conn->data || !conn->data->set.fdebug ||
|
if(!conn || !conn->data || !conn->data->set.fdebug ||
|
||||||
(direction != 0 && direction != 1))
|
(direction != 0 && direction != 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data = conn->data;
|
data = conn->data;
|
||||||
ssl_ver >>= 8;
|
|
||||||
#ifdef SSL2_VERSION_MAJOR
|
switch(ssl_ver) {
|
||||||
ver = (ssl_ver == SSL2_VERSION_MAJOR ? '2' :
|
#ifdef SSL2_VERSION_MAJOR /* removed in recent versions */
|
||||||
ssl_ver == SSL3_VERSION_MAJOR ? '3' : '?');
|
case SSL2_VERSION_MAJOR:
|
||||||
#else
|
verstr = "SSLv2";
|
||||||
ver = ssl_ver == SSL3_VERSION_MAJOR ? '3' : '?';
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SSL3_VERSION
|
||||||
|
case SSL3_VERSION:
|
||||||
|
verstr = "SSLv3";
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case TLS1_VERSION:
|
||||||
|
verstr = "TLSv1.0";
|
||||||
|
break;
|
||||||
|
case TLS1_1_VERSION:
|
||||||
|
verstr = "TLSv1.1";
|
||||||
|
break;
|
||||||
|
case TLS1_2_VERSION:
|
||||||
|
verstr = "TLSv1.2";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
snprintf(unknown, sizeof(unknown), "(%x)", ssl_ver);
|
||||||
|
verstr = unknown;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssl_ver >>= 8; /* check the upper 8 bits only below */
|
||||||
|
|
||||||
/* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL
|
/* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL
|
||||||
* always pass-up content-type as 0. But the interesting message-type
|
* always pass-up content-type as 0. But the interesting message-type
|
||||||
|
@ -1408,8 +1431,8 @@ static void ssl_tls_trace(int direction, int ssl_ver, int content_type,
|
||||||
msg_type = *(char*)buf;
|
msg_type = *(char*)buf;
|
||||||
msg_name = ssl_msg_type(ssl_ver, msg_type);
|
msg_name = ssl_msg_type(ssl_ver, msg_type);
|
||||||
|
|
||||||
txt_len = snprintf(ssl_buf, sizeof(ssl_buf), "SSLv%c, %s%s (%d):\n",
|
txt_len = snprintf(ssl_buf, sizeof(ssl_buf), "%s, %s%s (%d):\n",
|
||||||
ver, tls_rt_name, msg_name, msg_type);
|
verstr, tls_rt_name, msg_name, msg_type);
|
||||||
Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len, NULL);
|
Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len, NULL);
|
||||||
|
|
||||||
Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT :
|
Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT :
|
||||||
|
|
Loading…
Reference in New Issue