Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: honor pauseOnConnect option #29635

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ function TLSSocket(socket, opts) {
net.Socket.call(this, {
handle: this._wrapHandle(wrap),
allowHalfOpen: socket ? socket.allowHalfOpen : tlsOptions.allowHalfOpen,
readable: false,
pauseOnCreate: tlsOptions.pauseOnConnect,
readable: tlsOptions.pauseOnConnect,
r1b marked this conversation as resolved.
Show resolved Hide resolved
writable: false
});

Expand Down Expand Up @@ -925,7 +926,8 @@ function tlsConnectionListener(rawSocket) {
handshakeTimeout: this[kHandshakeTimeout],
ALPNProtocols: this.ALPNProtocols,
SNICallback: this[kSNICallback] || SNICallback,
enableTrace: this[kEnableTrace]
enableTrace: this[kEnableTrace],
pauseOnConnect: this.pauseOnConnect,
});

socket.on('secure', onServerSocketSecure);
Expand Down
5 changes: 5 additions & 0 deletions test/parallel/test-tls-server-parent-constructor-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const options = {
{
const server = tls.createServer(options, common.mustCall((socket) => {
assert.strictEqual(socket.allowHalfOpen, false);
assert.strictEqual(socket.isPaused(), false);
}));

assert.strictEqual(server.allowHalfOpen, false);
assert.strictEqual(server.pauseOnConnect, false);

server.listen(0, common.mustCall(() => {
const socket = tls.connect({
Expand All @@ -40,13 +42,16 @@ const options = {
{
const server = tls.createServer({
allowHalfOpen: true,
pauseOnConnect: true,
...options
}, common.mustCall((socket) => {
assert.strictEqual(socket.allowHalfOpen, true);
assert.strictEqual(socket.isPaused(), true);
socket.on('end', socket.end);
}));

assert.strictEqual(server.allowHalfOpen, true);
assert.strictEqual(server.pauseOnConnect, true);

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