diff options
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r-- | lib/_tls_wrap.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 0b844e6a82..b999c73329 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -63,6 +63,7 @@ const kErrorEmitted = Symbol('error-emitted'); const kHandshakeTimeout = Symbol('handshake-timeout'); const kRes = Symbol('res'); const kSNICallback = Symbol('snicallback'); +const kEnableTrace = Symbol('enableTrace'); const noop = () => {}; @@ -811,6 +812,7 @@ function makeSocketMethodProxy(name) { 'getSession', 'getTLSTicket', 'isSessionReused', + 'enableTrace', ].forEach((method) => { TLSSocket.prototype[method] = makeSocketMethodProxy(method); }); @@ -872,6 +874,8 @@ function tlsConnectionListener(rawSocket) { ALPNProtocols: this.ALPNProtocols, SNICallback: this[kSNICallback] || SNICallback }); + if (this[kEnableTrace] && socket._handle) + socket._handle.enableTrace(); socket.on('secure', onServerSocketSecure); @@ -992,6 +996,15 @@ function Server(options, listener) { if (listener) { this.on('secureConnection', listener); } + + const enableTrace = options.enableTrace; + if (enableTrace === true) + this[kEnableTrace] = true; + else if (enableTrace === false || enableTrace == null) + ; // Tracing explicitly disabled, or defaulting to disabled. + else + throw new ERR_INVALID_ARG_TYPE( + 'options.enableTrace', 'boolean', enableTrace); } Object.setPrototypeOf(Server.prototype, net.Server.prototype); |