From 7c3643b76788b15a5712a316831a35f1ab9b7f91 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Thu, 19 Dec 2013 13:04:34 +0400 Subject: [PATCH] tls: reintroduce socket.encrypted Just a property that is always `true` for TLS sockets. fix #6735 --- doc/api/tls.markdown | 5 +++++ lib/_tls_wrap.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown index d3dad29..59ce254 100644 --- a/doc/api/tls.markdown +++ b/doc/api/tls.markdown @@ -540,6 +540,11 @@ If `tlsSocket.authorized === false` then the error can be found in `tlsSocket.authorizationError`. Also if NPN was used - you can check `tlsSocket.npnProtocol` for negotiated protocol. +### tlsSocket.encrypted + +Static boolean value, always `true`. May be used to distinguish TLS sockets +from regular ones. + ### tlsSocket.authorized A boolean that is `true` if the peer certificate was signed by one of the diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index ac47895..861508b 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -172,6 +172,10 @@ function TLSSocket(socket, options) { this.authorized = false; this.authorizationError = null; + // Just a documented property to make secure sockets + // distinguishable from regular ones. + this.encrypted = true; + this.on('error', this._tlsError); if (!this._handle) -- 2.7.4