-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
errors: alter and test ERR_TLS_REQUIRED_SERVER_NAME #19988
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Replace ERR_TLS_REQUIRED_SERVER_NAME with ERR_MISSING_ARGS. Update tls.md documentation so that argument name in documentation reflects the argument name in code.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,18 +347,18 @@ called: | |
| * `tlsSocket` {tls.TLSSocket} The `tls.TLSSocket` instance from which the | ||
| error originated. | ||
|
|
||
| ### server.addContext(hostname, context) | ||
| ### server.addContext(servername, context) | ||
| <!-- YAML | ||
| added: v0.5.3 | ||
| --> | ||
|
|
||
| * `hostname` {string} A SNI hostname or wildcard (e.g. `'*'`) | ||
| * `servername` {string} A SNI hostname or wildcard (e.g. `'*'`) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "hostname" --> "server name", consistent with https://github.com/nodejs/node/blob/master/doc/api/tls.md#event-secureconnection
|
||
| * `context` {Object} An object containing any of the possible properties | ||
| from the [`tls.createSecureContext()`][] `options` arguments (e.g. `key`, | ||
| `cert`, `ca`, etc). | ||
|
|
||
| The `server.addContext()` method adds a secure context that will be used if | ||
| the client request's SNI name matches the supplied `hostname` (or wildcard). | ||
| the client request's SNI name matches the supplied `severname` (or wildcard). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "severname" -> "servername" (typo) |
||
|
|
||
| ### server.address() | ||
| <!-- YAML | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,13 +39,13 @@ const { owner_symbol } = require('internal/async_hooks').symbols; | |
| const { SecureContext: NativeSecureContext } = internalBinding('crypto'); | ||
| const { | ||
| ERR_INVALID_ARG_TYPE, | ||
| ERR_MISSING_ARGS, | ||
| ERR_MULTIPLE_CALLBACK, | ||
| ERR_SOCKET_CLOSED, | ||
| ERR_TLS_DH_PARAM_SIZE, | ||
| ERR_TLS_HANDSHAKE_TIMEOUT, | ||
| ERR_TLS_RENEGOTIATE, | ||
| ERR_TLS_RENEGOTIATION_DISABLED, | ||
| ERR_TLS_REQUIRED_SERVER_NAME, | ||
| ERR_TLS_SESSION_ATTACK, | ||
| ERR_TLS_SNI_FROM_SERVER | ||
| } = require('internal/errors').codes; | ||
|
|
@@ -1051,7 +1051,7 @@ Server.prototype.setOptions = util.deprecate(function(options) { | |
| // SNI Contexts High-Level API | ||
| Server.prototype.addContext = function(servername, context) { | ||
| if (!servername) { | ||
| throw new ERR_TLS_REQUIRED_SERVER_NAME(); | ||
| throw new ERR_MISSING_ARGS('servername'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the convention here would be: to test both the presence of the arg, but also its type. If it's not a string it will throw anyway now just below on the call to |
||
| } | ||
|
|
||
| var re = new RegExp('^' + | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,8 +87,8 @@ const clientResults = []; | |
| // check for throwing case where servername is not supplied | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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', | ||
| message: '"servername" is a required parameter' | ||
| code: 'ERR_MISSING_ARGS', | ||
| message: 'The "servername" argument must be specified' | ||
| }); | ||
|
|
||
| const server = tls.createServer(serverOptions, function(c) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed now, as its no longer used.