Permalink
Please
sign in to comment.
Browse files
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: #25517 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Loading branch information...
Showing
with
31 additions
and 0 deletions.
- +7 −0 doc/api/tls.md
- +5 −0 lib/_tls_wrap.js
- +19 −0 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); | |||
0 comments on commit
58952a1