@@ -10,6 +10,7 @@ const {
const DEFAULT_MIN_VERSION = tls .DEFAULT_MIN_VERSION ;
function test (cmin , cmax , cprot , smin , smax , sprot , expect ) {
assert (expect);
connect ({
client: {
checkServerIdentity : (servername , cert ) => { },
@@ -26,23 +27,18 @@ function test(cmin, cmax, cprot, smin, smax, sprot, expect) {
secureProtocol: sprot,
},
}, common .mustCall ((err , pair , cleanup ) => {
if (expect && expect . match ( / ^ ERR / ) ) {
assert .strictEqual (err .code , expect);
if (err ) {
assert .strictEqual (err .code , expect, err + ' .code !== ' + expect );
return cleanup ();
}
if (expect) {
assert .ifError (pair .server .err );
assert .ifError (pair .client .err );
assert (pair .server .conn );
assert (pair .client .conn );
assert .strictEqual (pair .client .conn .getProtocol (), expect);
assert .strictEqual (pair .server .conn .getProtocol (), expect);
return cleanup ();
}
assert (pair .server .err );
assert (pair .client .err );
assert .ifError (err);
assert .ifError (pair .server .err );
assert .ifError (pair .client .err );
assert (pair .server .conn );
assert (pair .client .conn );
assert .strictEqual (pair .client .conn .getProtocol (), expect);
assert .strictEqual (pair .server .conn .getProtocol (), expect);
return cleanup ();
}));
}
@@ -83,17 +79,18 @@ test(U, U, 'TLS_method', U, U, 'TLSv1_method', 'TLSv1');
test (U , U , ' TLSv1_2_method' , U , U , ' SSLv23_method' , ' TLSv1.2' );
if (DEFAULT_MIN_VERSION === ' TLSv1.2' ) {
test (U , U , ' TLSv1_1_method' , U , U , ' SSLv23_method' , null );
test (U , U , ' TLSv1_method' , U , U , ' SSLv23_method' , null );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_1_method' , null );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_method' , null );
test (U , U , ' TLSv1_1_method' , U , U , ' SSLv23_method' , ' ECONNRESET' );
test (U , U , ' TLSv1_method' , U , U , ' SSLv23_method' , ' ECONNRESET' );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_1_method' ,
' ERR_SSL_VERSION_TOO_LOW' );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_method' , ' ERR_SSL_VERSION_TOO_LOW' );
}
if (DEFAULT_MIN_VERSION === ' TLSv1.1' ) {
test (U , U , ' TLSv1_1_method' , U , U , ' SSLv23_method' , ' TLSv1.1' );
test (U , U , ' TLSv1_method' , U , U , ' SSLv23_method' , null );
test (U , U , ' TLSv1_method' , U , U , ' SSLv23_method' , ' ECONNRESET ' );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_1_method' , ' TLSv1.1' );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_method' , null );
test (U , U , ' SSLv23_method' , U , U , ' TLSv1_method' , ' ERR_SSL_VERSION_TOO_LOW ' );
}
if (DEFAULT_MIN_VERSION === ' TLSv1' ) {
@@ -111,18 +108,18 @@ test(U, U, 'TLSv1_method', U, U, 'TLSv1_method', 'TLSv1');
// The default default.
if (DEFAULT_MIN_VERSION === ' TLSv1.2' ) {
test (U , U , ' TLSv1_1_method' , U , U , U , null );
test (U , U , ' TLSv1_method' , U , U , U , null );
test (U , U , U , U , U , ' TLSv1_1_method' , null );
test (U , U , U , U , U , ' TLSv1_method' , null );
test (U , U , ' TLSv1_1_method' , U , U , U , ' ECONNRESET ' );
test (U , U , ' TLSv1_method' , U , U , U , ' ECONNRESET ' );
test (U , U , U , U , U , ' TLSv1_1_method' , ' ERR_SSL_VERSION_TOO_LOW ' );
test (U , U , U , U , U , ' TLSv1_method' , ' ERR_SSL_VERSION_TOO_LOW ' );
}
// The default with --tls-v1.1.
if (DEFAULT_MIN_VERSION === ' TLSv1.1' ) {
test (U , U , ' TLSv1_1_method' , U , U , U , ' TLSv1.1' );
test (U , U , ' TLSv1_method' , U , U , U , null );
test (U , U , ' TLSv1_method' , U , U , U , ' ECONNRESET ' );
test (U , U , U , U , U , ' TLSv1_1_method' , ' TLSv1.1' );
test (U , U , U , U , U , ' TLSv1_method' , null );
test (U , U , U , U , U , ' TLSv1_method' , ' ERR_SSL_VERSION_TOO_LOW ' );
}
// The default with --tls-v1.0.
0 comments on commit
ca9c0c9