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 in tls.Server constructor #29632

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ function TLSSocket(socket, opts) {
net.Socket.call(this, {
handle: this._wrapHandle(wrap),
allowHalfOpen: socket ? socket.allowHalfOpen : tlsOptions.allowHalfOpen,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As written, tlsOptions.allowHalfOpen will never be set - right? Should I also add that to the TLSSocket call in tlsConnectionListener?

pauseOnConnect: tlsOptions.pauseOnConnect,
readable: false,
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