Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a7b56a5

Browse filesBrowse files
r1bBridgeAR
authored andcommitted
tls: honor pauseOnConnect option
`pauseOnConnect` is now passed along to the net.Socket constructor from the tls.Socket constructor. The `readable` flag must match the value of `pauseOnConnect`. Tests were added to cover all available net.Server options when used in the tls.Server constructor. Fixes: #29620 Refs: #27665 PR-URL: #29635 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent ea9bf4a commit a7b56a5
Copy full SHA for a7b56a5

File tree

Expand file treeCollapse file tree

2 files changed

+10
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-2
lines changed
Open diff view settings
Collapse file

‎lib/_tls_wrap.js‎

Copy file name to clipboardExpand all lines: lib/_tls_wrap.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ function TLSSocket(socket, opts) {
411411
net.Socket.call(this, {
412412
handle: this._wrapHandle(wrap),
413413
allowHalfOpen: socket ? socket.allowHalfOpen : tlsOptions.allowHalfOpen,
414-
readable: false,
414+
pauseOnCreate: tlsOptions.pauseOnConnect,
415+
// The readable flag is only needed if pauseOnCreate will be handled.
416+
readable: tlsOptions.pauseOnConnect,
415417
writable: false
416418
});
417419

@@ -926,7 +928,8 @@ function tlsConnectionListener(rawSocket) {
926928
handshakeTimeout: this[kHandshakeTimeout],
927929
ALPNProtocols: this.ALPNProtocols,
928930
SNICallback: this[kSNICallback] || SNICallback,
929-
enableTrace: this[kEnableTrace]
931+
enableTrace: this[kEnableTrace],
932+
pauseOnConnect: this.pauseOnConnect,
930933
});
931934

932935
socket.on('secure', onServerSocketSecure);
Collapse file

‎test/parallel/test-tls-server-parent-constructor-options.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-server-parent-constructor-options.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ const options = {
1919
{
2020
const server = tls.createServer(options, common.mustCall((socket) => {
2121
assert.strictEqual(socket.allowHalfOpen, false);
22+
assert.strictEqual(socket.isPaused(), false);
2223
}));
2324

2425
assert.strictEqual(server.allowHalfOpen, false);
26+
assert.strictEqual(server.pauseOnConnect, false);
2527

2628
server.listen(0, common.mustCall(() => {
2729
const socket = tls.connect({
@@ -40,13 +42,16 @@ const options = {
4042
{
4143
const server = tls.createServer({
4244
allowHalfOpen: true,
45+
pauseOnConnect: true,
4346
...options
4447
}, common.mustCall((socket) => {
4548
assert.strictEqual(socket.allowHalfOpen, true);
49+
assert.strictEqual(socket.isPaused(), true);
4650
socket.on('end', socket.end);
4751
}));
4852

4953
assert.strictEqual(server.allowHalfOpen, true);
54+
assert.strictEqual(server.pauseOnConnect, true);
5055

5156
server.listen(0, common.mustCall(() => {
5257
const socket = tls.connect({

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.