Skip to content
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
Next Next commit
errors: alter and test ERR_TLS_REQUIRED_SERVER_NAME
changes the base instance for ERR_TLS_REQUIRED_SERVER_NAME
from Error to TypeError as a more accurate representation
of the error and adds a unit test for missing servername
input that triggers this error in Server.prototype.addContext
  • Loading branch information
davidmarkclements authored and Trott committed Nov 14, 2018
commit 4ba80ce0e508840a4e4e6436363a39ac90944b0b
4 changes: 1 addition & 3 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,10 +864,8 @@ E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error);
E('ERR_TLS_RENEGOTIATE', 'Attempt to renegotiate TLS session failed', Error);
E('ERR_TLS_RENEGOTIATION_DISABLED',
'TLS session renegotiation disabled for this socket', Error);

// This should probably be a `TypeError`.
E('ERR_TLS_REQUIRED_SERVER_NAME',
'"servername" is required parameter for Server.addContext', Error);
'"servername" is a required parameter', TypeError);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is now unused and should be removed.

E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error);
E('ERR_TLS_SNI_FROM_SERVER',
'Cannot issue SNI from a TLS server-side socket', Error);
Expand Down
7 changes: 7 additions & 0 deletions test/parallel/test-tls-sni-server-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ const clientsOptions = [{
const serverResults = [];
const clientResults = [];

// check for throwing case where servername is not supplied
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Puncutate the comment, please (leading capital, trailing period).

common.expectsError(tls.createServer(serverOptions, () => {}).addContext, {
type: TypeError,
code: 'ERR_TLS_REQUIRED_SERVER_NAME',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not ERR_MISSING_ARGS?

message: '"servername" is a required parameter'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The argument is called hostname in the docs, not sure what to use.

Copy link
Copy Markdown
Member

@BridgeAR BridgeAR Apr 15, 2018

Choose a reason for hiding this comment

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

Normally the variable name in the source code. I see the point here about using the documentation name though...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If docs and source code disagree, one or the other should be changed so they are in agreement.

});

const server = tls.createServer(serverOptions, function(c) {
serverResults.push(c.servername);
});
Expand Down