|
|
@ -37,6 +37,8 @@ try { |
|
|
|
var crypto = false; |
|
|
|
} |
|
|
|
|
|
|
|
var constants = process.binding('constants'); |
|
|
|
|
|
|
|
var stream = require('stream'); |
|
|
|
var util = require('util'); |
|
|
|
|
|
|
@ -57,6 +59,8 @@ function toBuf(str, encoding) { |
|
|
|
var assert = require('assert'); |
|
|
|
var StringDecoder = require('string_decoder').StringDecoder; |
|
|
|
|
|
|
|
var CONTEXT_DEFAULT_OPTIONS = undefined; |
|
|
|
|
|
|
|
function Credentials(secureProtocol, flags, context) { |
|
|
|
if (!(this instanceof Credentials)) { |
|
|
|
return new Credentials(secureProtocol, flags, context); |
|
|
@ -78,7 +82,20 @@ function Credentials(secureProtocol, flags, context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (flags) this.context.setOptions(flags); |
|
|
|
if (CONTEXT_DEFAULT_OPTIONS === undefined) { |
|
|
|
CONTEXT_DEFAULT_OPTIONS = 0; |
|
|
|
|
|
|
|
if (!binding.SSL3_ENABLE) |
|
|
|
CONTEXT_DEFAULT_OPTIONS |= constants.SSL_OP_NO_SSLv3; |
|
|
|
|
|
|
|
if (!binding.SSL2_ENABLE) |
|
|
|
CONTEXT_DEFAULT_OPTIONS |= constants.SSL_OP_NO_SSLv2; |
|
|
|
} |
|
|
|
|
|
|
|
if (flags === undefined) |
|
|
|
flags = CONTEXT_DEFAULT_OPTIONS; |
|
|
|
|
|
|
|
this.context.setOptions(flags); |
|
|
|
} |
|
|
|
|
|
|
|
exports.Credentials = Credentials; |
|
|
|