Marking a bunch of AsyncSSLSocket methods as "const".
authorMaxim Georgiev <maxgeorg@fb.com>
Fri, 11 Sep 2015 16:38:28 +0000 (09:38 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Fri, 11 Sep 2015 17:20:17 +0000 (10:20 -0700)
Summary: folly::AsyncSSLSocket class has a number of "get..." methods which don't change the object's state, but are not marked as "const". As a result these methods can't be called on objects passed through const pointer or referrence. Adding "const" modificator for these methods.

Reviewed By: @yfeldblum

Differential Revision: D2430134

folly/io/async/AsyncSSLSocket.h

index 31f8b6c..87d9154 100644 (file)
@@ -540,7 +540,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
    * Get the list of supported ciphers sent by the client in the client's
    * preference order.
    */
-  void getSSLClientCiphers(std::string& clientCiphers) {
+  void getSSLClientCiphers(std::string& clientCiphers) const {
     std::stringstream ciphersStream;
     std::string cipherName;
 
@@ -584,7 +584,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
   /**
    * Get the list of compression methods sent by the client in TLS Hello.
    */
-  std::string getSSLClientComprMethods() {
+  std::string getSSLClientComprMethods() const {
     if (!parseClientHello_) {
       return "";
     }
@@ -594,14 +594,14 @@ class AsyncSSLSocket : public virtual AsyncSocket {
   /**
    * Get the list of TLS extensions sent by the client in the TLS Hello.
    */
-  std::string getSSLClientExts() {
+  std::string getSSLClientExts() const {
     if (!parseClientHello_) {
       return "";
     }
     return folly::join(":", clientHelloInfo_->clientHelloExtensions_);
   }
 
-  std::string getSSLClientSigAlgs() {
+  std::string getSSLClientSigAlgs() const {
     if (!parseClientHello_) {
       return "";
     }
@@ -626,7 +626,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
    * Get the list of shared ciphers between the server and the client.
    * Works well for only SSLv2, not so good for SSLv3 or TLSv1.
    */
-  void getSSLSharedCiphers(std::string& sharedCiphers) {
+  void getSSLSharedCiphers(std::string& sharedCiphers) const {
     char ciphersBuffer[1024];
     ciphersBuffer[0] = '\0';
     SSL_get_shared_ciphers(ssl_, ciphersBuffer, sizeof(ciphersBuffer) - 1);
@@ -637,7 +637,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
    * Get the list of ciphers supported by the server in the server's
    * preference order.
    */
-  void getSSLServerCiphers(std::string& serverCiphers) {
+  void getSSLServerCiphers(std::string& serverCiphers) const {
     serverCiphers = SSL_get_cipher_list(ssl_, 0);
     int i = 1;
     const char *cipher;
@@ -716,7 +716,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
   };
 
   // For unit-tests
-  ClientHelloInfo* getClientHelloInfo() {
+  ClientHelloInfo* getClientHelloInfo() const {
     return clientHelloInfo_.get();
   }
 
@@ -724,7 +724,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
     minWriteSize_ = minWriteSize;
   }
 
-  size_t getMinWriteSize() {
+  size_t getMinWriteSize() const {
     return minWriteSize_;
   }