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 e879c5e

Browse filesBrowse files
mhdawsontargos
authored andcommitted
test: fix test-tls-junk-closes-server
Refs: #53382 TLS spec seems to indicate there should should be a response sent when TLS handshake fails. See https://datatracker.ietf.org/doc/html/rfc8446#page-85 When compiled with OpenSSL32 we see the the following response '15 03 03 00 02 02 16' which decodes as a fatal (0x02) TLS error alert number 22 (0x16). which corresponds to TLS1_AD_RECORD_OVERFLOW which matches the error we see if NODE_DEBUG is turned on once you get through the define aliases. If there is a response from the server the test used to hang because the end event will not be emitted until after the response is consumed. This PR fixes the test so it consumes the response. Some earlier OpenSSL versions did not seem to send a response but the error handling seems to have been re-written/improved in OpenSSL32. Signed-off-by: Michael Dawson <midawson@redhat.com> PR-URL: #55089 Refs: #52482 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jithil P Ponnan <jithil@outlook.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent b885f05 commit e879c5e
Copy full SHA for e879c5e

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-tls-junk-closes-server.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-junk-closes-server.js
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ const server = tls.createServer(options, common.mustNotCall());
3939
server.listen(0, common.mustCall(function() {
4040
const c = net.createConnection(this.address().port);
4141

42+
c.on('data', function() {
43+
// We must consume all data sent by the server. Otherwise the
44+
// end event will not be sent and the test will hang.
45+
// For example, when compiled with OpenSSL32 we see the
46+
// following response '15 03 03 00 02 02 16' which
47+
// decodes as a fatal (0x02) TLS error alert number 22 (0x16),
48+
// which corresponds to TLS1_AD_RECORD_OVERFLOW which matches
49+
// the error we see if NODE_DEBUG is turned on.
50+
// Some earlier OpenSSL versions did not seem to send a response
51+
// but the TLS spec seems to indicate there should be one
52+
// https://datatracker.ietf.org/doc/html/rfc8446#page-85
53+
// and error handling seems to have been re-written/improved
54+
// in OpenSSL32. Consuming the data allows the test to pass
55+
// either way.
56+
});
57+
4258
c.on('connect', common.mustCall(function() {
4359
c.write('blah\nblah\nblah\n');
4460
}));

0 commit comments

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