| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ee19e29 commit 348cc80
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -712,7 +712,10 @@ added: v0.11.8 | |||
| 712 | 712 | --> | |
| 713 | 713 | ||
| 714 | 714 | * `options` {Object} | |
| 715 | - * `rejectUnauthorized` {boolean} | ||
| 715 | + * `rejectUnauthorized` {boolean} If not `false`, the server certificate is verified | ||
| 716 | + against the list of supplied CAs. An `'error'` event is emitted if | ||
| 717 | + verification fails; `err.code` contains the OpenSSL error code. Defaults to | ||
| 718 | + `true`. | ||
| 716 | 719 | * `requestCert` | |
| 717 | 720 | * `callback` {Function} A function that will be called when the renegotiation | |
| 718 | 721 | request has been completed. | |
@@ -769,7 +772,7 @@ changes: | |||
| 769 | 772 | connection/disconnection/destruction of `socket` is the user's | |
| 770 | 773 | responsibility, calling `tls.connect()` will not cause `net.connect()` to be | |
| 771 | 774 | called. | |
| 772 | - * `rejectUnauthorized` {boolean} If `true`, the server certificate is verified | ||
| 775 | + * `rejectUnauthorized` {boolean} If not `false`, the server certificate is verified | ||
| 773 | 776 | against the list of supplied CAs. An `'error'` event is emitted if | |
| 774 | 777 | verification fails; `err.code` contains the OpenSSL error code. Defaults to | |
| 775 | 778 | `true`. | |
@@ -1012,9 +1015,9 @@ changes: | |||
| 1012 | 1015 | * `requestCert` {boolean} If `true` the server will request a certificate from | |
| 1013 | 1016 | clients that connect and attempt to verify that certificate. Defaults to | |
| 1014 | 1017 | `false`. | |
| 1015 | - * `rejectUnauthorized` {boolean} If `true` the server will reject any | ||
| 1018 | + * `rejectUnauthorized` {boolean} If not `false` the server will reject any | ||
| 1016 | 1019 | connection which is not authorized with the list of supplied CAs. This | |
| 1017 | - option only has an effect if `requestCert` is `true`. Defaults to `false`. | ||
| 1020 | + option only has an effect if `requestCert` is `true`. Defaults to `true`. | ||
| 1018 | 1021 | * `NPNProtocols` {string[]|Buffer} An array of strings or a `Buffer` naming | |
| 1019 | 1022 | possible NPN protocols. (Protocols should be ordered by their priority.) | |
| 1020 | 1023 | * `ALPNProtocols` {string[]|Buffer} An array of strings or a `Buffer` naming | |
@@ -1190,9 +1193,8 @@ changes: | |||
| 1190 | 1193 | opened as a server. | |
| 1191 | 1194 | * `requestCert` {boolean} `true` to specify whether a server should request a | |
| 1192 | 1195 | certificate from a connecting client. Only applies when `isServer` is `true`. | |
| 1193 | - * `rejectUnauthorized` {boolean} `true` to specify whether a server should | ||
| 1194 | - automatically reject clients with invalid certificates. Only applies when | ||
| 1195 | - `isServer` is `true`. | ||
| 1196 | + * `rejectUnauthorized` {boolean} If not `false` a server automatically reject clients | ||
| 1197 | + with invalid certificates. Only applies when `isServer` is `true`. | ||
| 1196 | 1198 | * `options` | |
| 1197 | 1199 | * `secureContext`: An optional TLS context object from | |
| 1198 | 1200 | [`tls.createSecureContext()`][] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -920,17 +920,8 @@ Server.prototype.setTicketKeys = function setTicketKeys(keys) { | |||
| 920 | 920 | ||
| 921 | 921 | ||
| 922 | 922 | Server.prototype.setOptions = function(options) { | |
| 923 | - if (typeof options.requestCert === 'boolean') { | ||
| 924 | - this.requestCert = options.requestCert; | ||
| 925 | - } else { | ||
| 926 | - this.requestCert = false; | ||
| 927 | - } | ||
| 928 | - | ||
| 929 | - if (typeof options.rejectUnauthorized === 'boolean') { | ||
| 930 | - this.rejectUnauthorized = options.rejectUnauthorized; | ||
| 931 | - } else { | ||
| 932 | - this.rejectUnauthorized = false; | ||
| 933 | - } | ||
| 923 | + this.requestCert = options.requestCert === true; | ||
| 924 | + this.rejectUnauthorized = options.rejectUnauthorized !== false; | ||
| 934 | 925 | ||
| 935 | 926 | if (options.pfx) this.pfx = options.pfx; | |
| 936 | 927 | if (options.key) this.key = options.key; | |
@@ -1062,7 +1053,7 @@ exports.connect = function(...args /* [port,] [host,] [options,] [cb] */) { | |||
| 1062 | 1053 | secureContext: context, | |
| 1063 | 1054 | isServer: false, | |
| 1064 | 1055 | requestCert: true, | |
| 1065 | - rejectUnauthorized: options.rejectUnauthorized, | ||
| 1056 | + rejectUnauthorized: options.rejectUnauthorized !== false, | ||
| 1066 | 1057 | session: options.session, | |
| 1067 | 1058 | NPNProtocols: NPN.NPNProtocols, | |
| 1068 | 1059 | ALPNProtocols: ALPN.ALPNProtocols, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,8 @@ const https = require('https'); | |||
| 42 | 42 | const options = { | |
| 43 | 43 | key: fs.readFileSync(common.fixturesDir + '/agent.key'), | |
| 44 | 44 | cert: fs.readFileSync(common.fixturesDir + '/agent.crt'), | |
| 45 | - requestCert: true | ||
| 45 | + requestCert: true, | ||
| 46 | + rejectUnauthorized: false | ||
| 46 | 47 | }; | |
| 47 | 48 | ||
| 48 | 49 | const modulus = 'A6F44A9C25791431214F5C87AF9E040177A8BB89AC803F7E09BBC3A5519F' + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,7 +56,8 @@ function doTest(testOptions, callback) { | |||
| 56 | 56 | key: key, | |
| 57 | 57 | cert: cert, | |
| 58 | 58 | ca: [cert], | |
| 59 | - requestCert: true | ||
| 59 | + requestCert: true, | ||
| 60 | + rejectUnauthorized: false | ||
| 60 | 61 | }; | |
| 61 | 62 | let requestCount = 0; | |
| 62 | 63 | let resumeCount = 0; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments