Change AsyncSSLSocket getSecurityProtocol to handle unencrypted mode
authorNeel Goyal <ngoyal@fb.com>
Thu, 17 Aug 2017 17:59:06 +0000 (10:59 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 17 Aug 2017 18:04:18 +0000 (11:04 -0700)
Summary: Return empty string for `getSecurityProtocol` if the socket is good and the handshake failed, otherwise "TLS"

Reviewed By: knekritz

Differential Revision: D5647637

fbshipit-source-id: b95cbf39e4bb7f89b1ebcbc0238c2becba7ad42a

folly/io/async/AsyncSSLSocket.h

index 044155dcbca6a37b749dce087197a34aa5d61e96..84551d77dea5b98f648962044b62eca9c8764ef8 100644 (file)
@@ -282,6 +282,9 @@ class AsyncSSLSocket : public virtual AsyncSocket {
   std::string getApplicationProtocol() noexcept override;
 
   std::string getSecurityProtocol() const override {
+    if (sslState_ == STATE_UNENCRYPTED) {
+      return "";
+    }
     return "TLS";
   }