فهرست منبع

Make Socket::initiateSecureConnection an empty method when HAVE_LIBSSL
is undefined

Tatsuhiro Tsujikawa 19 سال پیش
والد
کامیت
8a70369dcf
5فایلهای تغییر یافته به همراه10 افزوده شده و 15 حذف شده
  1. 0 3
      src/HttpRequestCommand.cc
  2. 0 3
      src/Socket.cc
  3. 4 3
      src/Socket.h
  4. 4 3
      src/SocketCore.cc
  5. 2 3
      src/SocketCore.h

+ 0 - 3
src/HttpRequestCommand.cc

@@ -36,12 +36,9 @@ HttpRequestCommand::~HttpRequestCommand() {}
 
 bool HttpRequestCommand::executeInternal(Segment seg) {
   socket->setNonBlockingMode();
-#ifdef HAVE_LIBSSL
-  // for SSL
   if(req->getProtocol() == "https") {
     socket->initiateSecureConnection();
   }
-#endif // HAVE_LIBSSL
   HttpConnection httpConnection(cuid, socket, e->option, e->logger);
   // set seg to request in order to remember the request range
   req->seg = seg;

+ 0 - 3
src/Socket.cc

@@ -81,9 +81,6 @@ void Socket::peekData(char* data, int& len, int timeout) {
   core->peekData(data, len, timeout);
 }
 
-#ifdef HAVE_LIBSSL
-// for SSL
 void Socket::initiateSecureConnection() {
   core->initiateSecureConnection();
 }
-#endif // HAVE_LIBSSL

+ 4 - 3
src/Socket.h

@@ -76,10 +76,11 @@ public:
   // this socket.
   void peekData(char* data, int& len, int timeout = 5);
 
-#ifdef HAVE_LIBSSL
-  // for SSL
+  /**
+   * Makes this socket secure.
+   * If the system has not OpenSSL, then this method do nothing.
+   */
   void initiateSecureConnection();
-#endif // HAVE_LIBSSL
 };
 
 #endif // _D_SOCKET_H_

+ 4 - 3
src/SocketCore.cc

@@ -193,9 +193,9 @@ void SocketCore::peekData(char* data, int& len, int timeout) {
   }
 }
 
-#ifdef HAVE_LIBSSL
-// for SSL
 void SocketCore::initiateSecureConnection() {
+#ifdef HAVE_LIBSSL
+  // for SSL
   if(!secure) {
     sslCtx = SSL_CTX_new(SSLv23_client_method());
     if(sslCtx == NULL) {
@@ -215,5 +215,6 @@ void SocketCore::initiateSecureConnection() {
     }
     secure = true;
   }
-}
 #endif // HAVE_LIBSSL
+}
+

+ 2 - 3
src/SocketCore.h

@@ -84,12 +84,11 @@ public:
   // this socket.
   void peekData(char* data, int& len, int timeout = 5);
   
-#ifdef HAVE_LIBSSL
   /**
-   * Makes this socket SSL endpoint
+   * Makes this socket secure.
+   * If the system has not OpenSSL, then this method do nothing.
    */
   void initiateSecureConnection();
-#endif // HAVE_LIB_SSL
 };
 
 #endif // _D_SOCKET_CORE_H_