diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2017-01-16 19:36:42 -0800 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2017-02-20 08:01:07 -0800 |
commit | 4e6efc1dec0eb924b68d74648b661433119306fe (patch) | |
tree | 8e1b100115b7f98740a57b1e0aa4a3a1e400a665 /test | |
parent | bd947def9b4b2e8434dc8ad28fd271ccab46ec0d (diff) | |
download | node-new-4e6efc1dec0eb924b68d74648b661433119306fe.tar.gz |
tls: new tls.TLSSocket() supports sec ctx options
Add support to new tls.TLSSocket() to create a SecureContext object with
all its supported options, in the same way they are supported for all
the other APIs that need SecureContext objects.
Fix: https://github.com/nodejs/node/issues/10538
PR-URL: https://github.com/nodejs/node/pull/11005
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-tls-socket-default-options.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/parallel/test-tls-socket-default-options.js b/test/parallel/test-tls-socket-default-options.js index b4c5a9754e..24b7a5d34e 100644 --- a/test/parallel/test-tls-socket-default-options.js +++ b/test/parallel/test-tls-socket-default-options.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -// Test a directly created TLS socket supports no options, and empty options. +// Test directly created TLS sockets and options. const assert = require('assert'); const join = require('path').join; @@ -26,6 +26,16 @@ test({secureContext: tls.createSecureContext({ca: keys.agent1.ca})}, (err) => { assert.ifError(err); }); +test({ca: keys.agent1.ca}, (err) => { + assert.ifError(err); +}); + +// Secure context options, like ca, are ignored if a sec ctx is explicitly +// provided. +test({secureContext: tls.createSecureContext(), ca: keys.agent1.ca}, (err) => { + assert.strictEqual(err.message, 'unable to verify the first certificate'); +}); + function test(client, callback) { callback = common.mustCall(callback); connect({ |