Skip to content

Conversation

@azadgupta1
Copy link
Contributor

Fixes #61075

This PR documents the timeout option supported by tls.connect() since
v11.8.0 / v10.16.0 and fixes misleading wording suggesting it comes from
socket.connect(). The option is inherited from net.createConnection()
and is equivalent to calling socket.setTimeout().

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tls Issues and PRs related to the tls subsystem. labels Dec 16, 2025
@azadgupta1 azadgupta1 force-pushed the doc-tls-connect-timeout branch 2 times, most recently from 9d8df44 to 3b73269 Compare December 16, 2025 01:50
@azadgupta1 azadgupta1 closed this Dec 16, 2025
@azadgupta1 azadgupta1 force-pushed the doc-tls-connect-timeout branch from 3b73269 to 6c306b6 Compare December 16, 2025 02:11
@azadgupta1 azadgupta1 reopened this Dec 16, 2025
@azadgupta1 azadgupta1 force-pushed the doc-tls-connect-timeout branch 2 times, most recently from 78da2b7 to fb40d84 Compare December 16, 2025 03:27
@azadgupta1 azadgupta1 force-pushed the doc-tls-connect-timeout branch from fb40d84 to 6bd585e Compare December 16, 2025 03:39
@ikeyan
Copy link

ikeyan commented Dec 25, 2025

@azadgupta1 The timeout option is not inherited from net.createConnection. It is implemented by calling tlssock.setTimeout(options.timeout). https://github.com/nodejs/node/blob/main/lib/internal/tls/wrap.js#L1758
Other options from net.createConnection (e.g. fd, readable, writable, inherited via new net.Socket([options])) are not available.

Comment on lines +1733 to +1736
* `timeout` {number} Sets the socket to timeout after `timeout` milliseconds
of inactivity. By default, no timeout is set. This option is supported
because `tls.connect()` internally uses [`net.createConnection()`][]
and is equivalent to calling [`socket.setTimeout()`][] on the returned socket.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original description (ff8539e) is more concise and accurate, can you please restore it?

@@ -1740,7 +1744,7 @@ changes:
`onread` option of [`net.Socket`][] for details.
* ...: [`tls.createSecureContext()`][] options that are used if the
`secureContext` option is missing, otherwise they are ignored.
* ...: Any [`socket.connect()`][] option not already listed.
* ...: Any [`net.createConnection()`][] option not already listed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(tls): tls.connect() supports timeout option but it is undocumented and misleadingly described

4 participants