tls: reintroduce socket.encrypted
authorFedor Indutny <fedor.indutny@gmail.com>
Thu, 19 Dec 2013 09:04:34 +0000 (13:04 +0400)
committerFedor Indutny <fedor.indutny@gmail.com>
Fri, 20 Dec 2013 21:03:05 +0000 (01:03 +0400)
Just a property that is always `true` for TLS sockets.

fix #6735

doc/api/tls.markdown
lib/_tls_wrap.js

index d3dad29..59ce254 100644 (file)
@@ -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
index ac47895..861508b 100644 (file)
@@ -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)