| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 45b59e5 commit 602b9d6
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,7 +151,8 @@ function onSession(session, next) { | |||
| 151 | 151 | // Incompatible ALPN TLS client | |
| 152 | 152 | tls(Object.assign({ port, ALPNProtocols: ['fake'] }, clientOptions)) | |
| 153 | 153 | .on('error', common.mustCall((err) => { | |
| 154 | - strictEqual(err.code, 'ECONNRESET'); | ||
| 154 | + const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL']; | ||
| 155 | + ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`); | ||
| 155 | 156 | cleanup(); | |
| 156 | 157 | testNoALPN(); | |
| 157 | 158 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,7 @@ server.listen(0, function() { | |||
| 42 | 42 | rejectUnauthorized: false, | |
| 43 | 43 | ALPNProtocols: ['bogus'] | |
| 44 | 44 | }).on('error', common.mustCall((err) => { | |
| 45 | - assert.strictEqual(err.code, 'ECONNRESET'); | ||
| 45 | + const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL']; | ||
| 46 | + assert.ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`); | ||
| 46 | 47 | })); | |
| 47 | 48 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,15 +184,17 @@ function TestFatalAlert() { | |||
| 184 | 184 | server.listen(0, serverIP, common.mustCall(() => { | |
| 185 | 185 | const { port } = server.address(); | |
| 186 | 186 | ||
| 187 | - // The Node.js client will just report ECONNRESET because the connection | ||
| 187 | + // The Node.js client will just report ECONNRESET (older OpenSSL) or | ||
| 188 | + // ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL because the connection | ||
| 188 | 189 | // is severed before the TLS handshake completes. | |
| 189 | 190 | tls.connect({ | |
| 190 | 191 | host: serverIP, | |
| 191 | 192 | port, | |
| 192 | 193 | rejectUnauthorized: false, | |
| 193 | 194 | ALPNProtocols: ['bar'] | |
| 194 | 195 | }, common.mustNotCall()).on('error', common.mustCall((err) => { | |
| 195 | - assert.strictEqual(err.code, 'ECONNRESET'); | ||
| 196 | + const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL']; | ||
| 197 | + assert.ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`); | ||
| 196 | 198 | ||
| 197 | 199 | // OpenSSL's s_client should output the TLS alert number, which is 120 | |
| 198 | 200 | // for the 'no_application_protocol' alert. | |
@@ -240,7 +242,8 @@ function TestALPNCallback() { | |||
| 240 | 242 | ||
| 241 | 243 | // Callback picks 2nd preference => undefined => ALPN rejected: | |
| 242 | 244 | assert.strictEqual(results[1].server, undefined); | |
| 243 | - assert.strictEqual(results[1].client.error.code, 'ECONNRESET'); | ||
| 245 | + const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL']; | ||
| 246 | + assert.ok(allowedErrors.includes(results[1].client.error.code), `'${results[1].client.error.code}' was not one of ${allowedErrors}.`); | ||
| 244 | 247 | ||
| 245 | 248 | TestBadALPNCallback(); | |
| 246 | 249 | }); | |
@@ -263,7 +266,8 @@ function TestBadALPNCallback() { | |||
| 263 | 266 | runTest(clientsOptions, serverOptions, function(results) { | |
| 264 | 267 | // Callback returns 'http/5' => doesn't match client ALPN => error & reset | |
| 265 | 268 | assert.strictEqual(results[0].server, undefined); | |
| 266 | - assert.strictEqual(results[0].client.error.code, 'ECONNRESET'); | ||
| 269 | + const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL']; | ||
| 270 | + assert.ok(allowedErrors.includes(results[0].client.error.code), `'${results[0].client.error.code}' was not one of ${allowedErrors}.`); | ||
| 267 | 271 | ||
| 268 | 272 | TestALPNOptionsCallback(); | |
| 269 | 273 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments