summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-pfx-authorizationerror.js
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2018-03-14 03:13:29 +0530
committerLuigi Pinca <luigipinca@gmail.com>2018-03-18 18:55:09 +0100
commitd54e0f8e52ff5f63c696a82509098f09f0625d3f (patch)
treeddc1473d8aa6a92eeb01621cfc5302d593b316f6 /test/parallel/test-tls-pfx-authorizationerror.js
parentd74184c2fa356a0f1cda99803d26a768f23a18bf (diff)
downloadandroid-node-v8-d54e0f8e52ff5f63c696a82509098f09f0625d3f.tar.gz
android-node-v8-d54e0f8e52ff5f63c696a82509098f09f0625d3f.tar.bz2
android-node-v8-d54e0f8e52ff5f63c696a82509098f09f0625d3f.zip
test: rename regression tests file names
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-GH-io-1068 to test-tty-stdin-end - Rename test-regress-GH-io-1811 to test-zlib-kmaxlength-rangeerror - Rename test-regress-GH-node-9326 to test-kill-segfault-freebsd - Rename test-timers-regress-GH-9765 to test-timers-setimmediate-infinite-loop - Rename test-tls-pfx-gh-5100-regr to test-tls-pfx-authorizationerror - Rename test-tls-regr-gh-5108 to test-tls-tlswrap-segfault PR-URL: https://github.com/nodejs/node/pull/19332 Fixes: https://github.com/nodejs/node/issues/19105 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Diffstat (limited to 'test/parallel/test-tls-pfx-authorizationerror.js')
-rw-r--r--test/parallel/test-tls-pfx-authorizationerror.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/parallel/test-tls-pfx-authorizationerror.js b/test/parallel/test-tls-pfx-authorizationerror.js
new file mode 100644
index 0000000000..64b6e1485d
--- /dev/null
+++ b/test/parallel/test-tls-pfx-authorizationerror.js
@@ -0,0 +1,42 @@
+'use strict';
+const common = require('../common');
+if (!common.hasCrypto)
+ common.skip('node compiled without crypto.');
+const fixtures = require('../common/fixtures');
+
+// This test ensures that TLS does not fail to read a self-signed certificate
+// and thus throw an `authorizationError`.
+// https://github.com/nodejs/node/issues/5100
+
+const assert = require('assert');
+const tls = require('tls');
+
+const pfx = fixtures.readKey('agent1-pfx.pem');
+
+const server = tls
+ .createServer(
+ {
+ pfx: pfx,
+ passphrase: 'sample',
+ requestCert: true,
+ rejectUnauthorized: false
+ },
+ common.mustCall(function(c) {
+ assert.strictEqual(c.authorizationError, null);
+ c.end();
+ })
+ )
+ .listen(0, function() {
+ const client = tls.connect(
+ {
+ port: this.address().port,
+ pfx: pfx,
+ passphrase: 'sample',
+ rejectUnauthorized: false
+ },
+ function() {
+ client.end();
+ server.close();
+ }
+ );
+ });