-
-
Notifications
You must be signed in to change notification settings - Fork 916
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
General improvements to HTTPS API (Second Edition) #1435
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c0d26ee
`https.ciphers` and `https.honorCipherOrder` options
Giotino 9f879ac
Linting...
Giotino e4d6cdf
`minVersion` and `maxVersion`
Giotino 6350dfb
Linting...
Giotino 098d6ee
Downgrade Travis CI Node.js version to 14.9.0 (#1454)
Giotino 2f350d7
Dynamic generation of the ciphers list
Giotino 3dbea99
Merge branch 'master' into https-options
Giotino da7fcd8
Merge branch 'master' into https-options
Giotino 89d539b
Fixed merge
Giotino File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -857,6 +857,20 @@ export interface HTTPSOptions { | |
The passphrase to decrypt the `options.https.key` (if different keys have different passphrases refer to `options.https.key` documentation). | ||
*/ | ||
passphrase?: SecureContextOptions['passphrase']; | ||
|
||
// TODO add comment | ||
ciphers?: SecureContextOptions['ciphers']; | ||
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. Can we make this support an array of ciphers instead of string with |
||
|
||
// TODO add comment | ||
honorCipherOrder?: SecureContextOptions['honorCipherOrder']; | ||
|
||
// TODO add comment | ||
minVersion?: SecureContextOptions['minVersion']; | ||
|
||
// TODO add comment | ||
maxVersion?: SecureContextOptions['maxVersion']; | ||
|
||
// TODO add comment | ||
pfx?: SecureContextOptions['pfx']; | ||
} | ||
|
||
|
@@ -1544,6 +1558,10 @@ export default class Request extends Duplex implements RequestEvents<Request> { | |
assert.any([is.string, is.object, is.array, is.undefined], options.https.key); | ||
assert.any([is.string, is.object, is.array, is.undefined], options.https.certificate); | ||
assert.any([is.string, is.undefined], options.https.passphrase); | ||
assert.any([is.string, is.undefined], options.https.ciphers); | ||
assert.any([is.boolean, is.undefined], options.https.honorCipherOrder); | ||
assert.any([is.string, is.undefined], options.https.minVersion); | ||
assert.any([is.string, is.undefined], options.https.maxVersion); | ||
assert.any([is.string, is.buffer, is.array, is.undefined], options.https.pfx); | ||
} | ||
|
||
|
@@ -1816,33 +1834,28 @@ export default class Request extends Duplex implements RequestEvents<Request> { | |
deprecationWarning('"options.family" was never documented, please use "options.dnsLookupIpVersion"'); | ||
} | ||
|
||
// HTTPS options | ||
// HTTPS Options | ||
if (defaults?.https) { | ||
options.https = {...defaults.https, ...options.https}; | ||
} | ||
|
||
if ('rejectUnauthorized' in options) { | ||
deprecationWarning('"options.rejectUnauthorized" is now deprecated, please use "options.https.rejectUnauthorized"'); | ||
} | ||
|
||
if ('checkServerIdentity' in options) { | ||
deprecationWarning('"options.checkServerIdentity" was never documented, please use "options.https.checkServerIdentity"'); | ||
} | ||
|
||
if ('ca' in options) { | ||
deprecationWarning('"options.ca" was never documented, please use "options.https.certificateAuthority"'); | ||
} | ||
|
||
if ('key' in options) { | ||
deprecationWarning('"options.key" was never documented, please use "options.https.key"'); | ||
} | ||
|
||
if ('cert' in options) { | ||
deprecationWarning('"options.cert" was never documented, please use "options.https.certificate"'); | ||
} | ||
const deprecatedHttpsOptions = { | ||
rejectUnauthorized: 'rejectUnauthorized', | ||
checkServerIdentity: 'checkServerIdentity', | ||
ca: 'certificateAuthority', | ||
key: 'key', | ||
cert: 'certificate', | ||
passphrase: 'passphrase', | ||
ciphers: 'ciphers', | ||
honorCipherOrder: 'honorCipherOrder', | ||
minVersion: 'minVersion', | ||
maxVersion: 'maxVersion' | ||
}; | ||
|
||
if ('passphrase' in options) { | ||
deprecationWarning('"options.passphrase" was never documented, please use "options.https.passphrase"'); | ||
for (const httpsOption in deprecatedHttpsOptions) { | ||
if (httpsOption in options) { | ||
deprecationWarning(`"options.${httpsOption}" is now deprecated, please use "options.https.${httpsOption}"`); | ||
} | ||
} | ||
|
||
if ('pfx' in options) { | ||
|
@@ -2406,6 +2419,22 @@ export default class Request extends Duplex implements RequestEvents<Request> { | |
requestOptions.passphrase = options.https.passphrase; | ||
} | ||
|
||
if (options.https.ciphers) { | ||
requestOptions.ciphers = options.https.ciphers; | ||
} | ||
|
||
if ('honorCipherOrder' in options.https) { | ||
requestOptions.honorCipherOrder = options.https.honorCipherOrder; | ||
} | ||
|
||
if (options.https.minVersion) { | ||
requestOptions.minVersion = options.https.minVersion; | ||
} | ||
|
||
if (options.https.maxVersion) { | ||
requestOptions.maxVersion = options.https.maxVersion; | ||
} | ||
|
||
if (options.https.pfx) { | ||
requestOptions.pfx = options.https.pfx; | ||
} | ||
|
@@ -2450,6 +2479,22 @@ export default class Request extends Duplex implements RequestEvents<Request> { | |
delete requestOptions.passphrase; | ||
} | ||
|
||
if (options.https.ciphers) { | ||
delete requestOptions.ciphers; | ||
} | ||
|
||
if ('honorCipherOrder' in options.https) { | ||
delete requestOptions.honorCipherOrder; | ||
} | ||
|
||
if (options.https.minVersion) { | ||
delete requestOptions.minVersion; | ||
} | ||
|
||
if (options.https.maxVersion) { | ||
delete requestOptions.maxVersion; | ||
} | ||
|
||
if (options.https.pfx) { | ||
delete requestOptions.pfx; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.