summaryrefslogtreecommitdiff
path: root/test/parallel
diff options
context:
space:
mode:
authorLuigi Pinca <luigipinca@gmail.com>2019-01-15 16:12:12 +0100
committerLuigi Pinca <luigipinca@gmail.com>2019-01-20 14:56:35 +0100
commitaaa7547e7779520428a2e48b728a5993b00c330a (patch)
tree24015b90d6f21eb67eff9c7952022c79c3878c17 /test/parallel
parentcc26957cc30d89619d3b9be85f5301111e17615a (diff)
downloadandroid-node-v8-aaa7547e7779520428a2e48b728a5993b00c330a.tar.gz
android-node-v8-aaa7547e7779520428a2e48b728a5993b00c330a.tar.bz2
android-node-v8-aaa7547e7779520428a2e48b728a5993b00c330a.zip
tls: make tls.connect() accept a timeout option
If specified, and only when a socket is created internally, the option will make `socket.setTimeout()` to be called on the created socket with the given timeout. This is consistent with the `timeout` option of `net.connect()` and prevents the `timeout` option of the `https.Agent` from being ignored when a socket is created. PR-URL: https://github.com/nodejs/node/pull/25517 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel')
-rw-r--r--test/parallel/test-tls-connect-timeout-option.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parallel/test-tls-connect-timeout-option.js b/test/parallel/test-tls-connect-timeout-option.js
new file mode 100644
index 0000000000..4e4d432590
--- /dev/null
+++ b/test/parallel/test-tls-connect-timeout-option.js
@@ -0,0 +1,19 @@
+'use strict';
+
+const common = require('../common');
+
+// This test verifies that `tls.connect()` honors the `timeout` option when the
+// socket is internally created.
+
+if (!common.hasCrypto)
+ common.skip('missing crypto');
+
+const assert = require('assert');
+const tls = require('tls');
+
+const socket = tls.connect({
+ lookup: () => {},
+ timeout: 1000
+});
+
+assert.strictEqual(socket.timeout, 1000);