tls: deprecate Server.prototype.setOptions() · nodejs/node@246a6fc (original) (raw)

`@@ -827,16 +827,19 @@ function Server(options, listener) {

`

827

827

`throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);

`

828

828

`}

`

829

829

``

830

``

-

831

830

`this._contexts = [];

`

``

831

`+

this.requestCert = options.requestCert === true;

`

``

832

`+

this.rejectUnauthorized = options.rejectUnauthorized !== false;

`

832

833

``

833

``

`-

// Handle option defaults:

`

834

``

`-

this.setOptions(options);

`

``

834

`+

if (options.sessionTimeout)

`

``

835

`+

this.sessionTimeout = options.sessionTimeout;

`

``

836

+

``

837

`+

if (options.ticketKeys)

`

``

838

`+

this.ticketKeys = options.ticketKeys;

`

``

839

+

``

840

`+

if (options.ALPNProtocols)

`

``

841

`+

tls.convertALPNProtocols(options.ALPNProtocols, this);

`

835

842

``

836

``

`-

// setSecureContext() overlaps with setOptions() quite a bit. setOptions()

`

837

``

`-

// is an undocumented API that was probably never intended to be exposed

`

838

``

`-

// publicly. Unfortunately, it would be a breaking change to just remove it,

`

839

``

`-

// and there is at least one test that depends on it.

`

840

843

`this.setSecureContext(options);

`

841

844

``

842

845

`this[kHandshakeTimeout] = options.handshakeTimeout || (120 * 1000);

`

`@@ -998,7 +1001,7 @@ Server.prototype.setTicketKeys = function setTicketKeys(keys) {

`

998

1001

`};

`

999

1002

``

1000

1003

``

1001

``

`-

Server.prototype.setOptions = function(options) {

`

``

1004

`+

Server.prototype.setOptions = util.deprecate(function(options) {

`

1002

1005

`this.requestCert = options.requestCert === true;

`

1003

1006

`this.rejectUnauthorized = options.rejectUnauthorized !== false;

`

1004

1007

``

`@@ -1033,7 +1036,7 @@ Server.prototype.setOptions = function(options) {

`

1033

1036

`.digest('hex')

`

1034

1037

`.slice(0, 32);

`

1035

1038

`}

`

1036

``

`-

};

`

``

1039

`+

}, 'Server.prototype.setOptions() is deprecated', 'DEP0122');

`

1037

1040

``

1038

1041

`// SNI Contexts High-Level API

`

1039

1042

`Server.prototype.addContext = function(servername, context) {

`