| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e65ad86 commit 7aa1df7
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1809,6 +1809,14 @@ recommended to use 2048 bits or larger for stronger security. | |||
| 1809 | 1809 | A TLS/SSL handshake timed out. In this case, the server must also abort the | |
| 1810 | 1810 | connection. | |
| 1811 | 1811 | ||
| 1812 | + <a id="ERR_TLS_INVALID_CONTEXT"> | ||
| 1813 | + ### ERR_TLS_INVALID_CONTEXT | ||
| 1814 | + <!-- YAML | ||
| 1815 | + added: REPLACEME | ||
| 1816 | + --> | ||
| 1817 | + | ||
| 1818 | + The context must be a `SecureContext`. | ||
| 1819 | + | ||
| 1812 | 1820 | <a id="ERR_TLS_INVALID_PROTOCOL_METHOD"></a> | |
| 1813 | 1821 | ### ERR_TLS_INVALID_PROTOCOL_METHOD | |
| 1814 | 1822 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,6 +56,7 @@ const { | |||
| 56 | 56 | ERR_SOCKET_CLOSED, | |
| 57 | 57 | ERR_TLS_DH_PARAM_SIZE, | |
| 58 | 58 | ERR_TLS_HANDSHAKE_TIMEOUT, | |
| 59 | + ERR_TLS_INVALID_CONTEXT, | ||
| 59 | 60 | ERR_TLS_RENEGOTIATION_DISABLED, | |
| 60 | 61 | ERR_TLS_REQUIRED_SERVER_NAME, | |
| 61 | 62 | ERR_TLS_SESSION_ATTACK, | |
@@ -517,8 +518,9 @@ TLSSocket.prototype._wrapHandle = function(wrap) { | |||
| 517 | 518 | options.credentials || | |
| 518 | 519 | tls.createSecureContext(options); | |
| 519 | 520 | assert(handle.isStreamBase, 'handle must be a StreamBase'); | |
| 520 | - assert(context.context instanceof NativeSecureContext, | ||
| 521 | - 'context.context must be a NativeSecureContext'); | ||
| 521 | + if (!(context.context instanceof NativeSecureContext)) { | ||
| 522 | + throw new ERR_TLS_INVALID_CONTEXT('context'); | ||
| 523 | + } | ||
| 522 | 524 | const res = tls_wrap.wrap(handle, context.context, !!options.isServer); | |
| 523 | 525 | res._parent = handle; // C++ "wrap" object: TCPWrap, JSStream, ... | |
| 524 | 526 | res._parentWrap = wrap; // JS object: net.Socket, JSStreamSocket, ... | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1169,6 +1169,7 @@ E('ERR_TLS_CERT_ALTNAME_INVALID', function(reason, host, cert) { | |||
| 1169 | 1169 | }, Error); | |
| 1170 | 1170 | E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error); | |
| 1171 | 1171 | E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error); | |
| 1172 | + E('ERR_TLS_INVALID_CONTEXT', '%s must be a SecureContext', TypeError), | ||
| 1172 | 1173 | E('ERR_TLS_INVALID_PROTOCOL_VERSION', | |
| 1173 | 1174 | '%j is not a valid %s TLS protocol version', TypeError); | |
| 1174 | 1175 | E('ERR_TLS_PROTOCOL_VERSION_CONFLICT', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,9 +78,13 @@ common.expectsError( | |||
| 78 | 78 | assert.throws(() => tls.createServer({ ticketKeys: Buffer.alloc(0) }), | |
| 79 | 79 | /TypeError: Ticket keys length must be 48 bytes/); | |
| 80 | 80 | ||
| 81 | - common.expectsInternalAssertion( | ||
| 81 | + assert.throws( | ||
| 82 | 82 | () => tls.createSecurePair({}), | |
| 83 | - 'context.context must be a NativeSecureContext' | ||
| 83 | + { | ||
| 84 | + message: 'context must be a SecureContext', | ||
| 85 | + code: 'ERR_TLS_INVALID_CONTEXT', | ||
| 86 | + name: 'TypeError', | ||
| 87 | + } | ||
| 84 | 88 | ); | |
| 85 | 89 | ||
| 86 | 90 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments