File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -436,6 +436,9 @@ dictionary with keys:
436436 Consult
437437 < http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT >
438438 for details on the format.
439+ * ` honorCipherOrder ` : When choosing a cipher, use the server's preferences
440+ instead of the client preferences. For further details see ` tls ` module
441+ documentation.
439442
440443If no 'ca' details are given, then node.js will use the default
441444publicly trusted list of CAs as given in
@@ -608,7 +611,8 @@ more information.
608611
609612Add secure context that will be used if client request's SNI hostname is
610613matching passed ` hostname ` (wildcards can be used). ` context ` can contain
611- ` key ` , ` cert ` and ` ca ` .
614+ ` key ` , ` cert ` , ` ca ` and/or any other properties from ` tls.createSecureContext `
615+ ` options ` argument.
612616
613617### server.maxConnections
614618
Original file line number Diff line number Diff line change 2020// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121
2222var util = require ( 'util' ) ;
23+ var constants = require ( 'constants' ) ;
2324var tls = require ( 'tls' ) ;
2425
2526// Lazily loaded
@@ -54,9 +55,11 @@ exports.SecureContext = SecureContext;
5455exports . createSecureContext = function createSecureContext ( options , context ) {
5556 if ( ! options ) options = { } ;
5657
57- var c = new SecureContext ( options . secureProtocol ,
58- options . secureOptions ,
59- context ) ;
58+ var secureOptions = options . secureOptions ;
59+ if ( options . honorCipherOrder )
60+ secureOptions |= constants . SSL_OP_CIPHER_SERVER_PREFERENCE ;
61+
62+ var c = new SecureContext ( options . secureProtocol , secureOptions , context ) ;
6063
6164 if ( context ) return c ;
6265
Original file line number Diff line number Diff line change @@ -602,6 +602,7 @@ function Server(/* [options], listener */) {
602602 ecdhCurve : self . ecdhCurve ,
603603 secureProtocol : self . secureProtocol ,
604604 secureOptions : self . secureOptions ,
605+ honorCipherOrder : self . honorCipherOrder ,
605606 crl : self . crl ,
606607 sessionIdContext : self . sessionIdContext
607608 } ) ;
@@ -720,9 +721,10 @@ Server.prototype.setOptions = function(options) {
720721 if ( options . sessionTimeout ) this . sessionTimeout = options . sessionTimeout ;
721722 if ( options . ticketKeys ) this . ticketKeys = options . ticketKeys ;
722723 var secureOptions = options . secureOptions || 0 ;
723- if ( options . honorCipherOrder ) {
724- secureOptions |= constants . SSL_OP_CIPHER_SERVER_PREFERENCE ;
725- }
724+ if ( options . honorCipherOrder )
725+ this . honorCipherOrder = true ;
726+ else
727+ this . honorCipherOrder = false ;
726728 if ( secureOptions ) this . secureOptions = secureOptions ;
727729 if ( options . NPNProtocols ) tls . convertNPNProtocols ( options . NPNProtocols , this ) ;
728730 if ( options . sessionIdContext ) {
You can’t perform that action at this time.
0 commit comments