]> granicus.if.org Git - curl/commitdiff
curl_global_init() support for CURL_GLOBAL_NOT_SSL
authorDaniel Stenberg <daniel@haxx.se>
Wed, 30 May 2001 08:00:29 +0000 (08:00 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 30 May 2001 08:00:29 +0000 (08:00 +0000)
include/curl/curl.h
lib/easy.c
lib/ssluse.c

index f4cf0318c608853a94e988f36625155bcd9f6dba..a6b9d7c3765949f8e785b3055968a8f14caf6819 100644 (file)
@@ -573,6 +573,9 @@ typedef enum {
   CURLCLOSEPOLICY_LAST /* last, never use this */
 } curl_closepolicy;
 
+#define CURL_GLOBAL_NOT_SSL (1<<0)
+#define CURL_GLOBAL_NOTHING CURL_GLOBAL_NOT_SSL
+#define CURL_GLOBAL_DEFAULT 0
 
 #ifdef  __cplusplus
 }
index c98727e78d908c90a960e5dd2e24f57ade56c6b8..a4de38e17f25f8d66bac61c9118eeabab140beb8 100644 (file)
@@ -80,8 +80,9 @@
 
 CURLcode curl_global_init(long flags)
 {
-  flags = 0; /* not currently used */
-  Curl_SSL_init();
+  if(!(flags & CURL_GLOBAL_NOT_SSL))
+    Curl_SSL_init();
+
   return CURLE_OK;
 }
 
index 3707a4965e88fcd66cbb01344134f418e8986f42..0d50c07f46dde6d41775870d22d551cce4debf5e 100644 (file)
@@ -235,17 +235,21 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
 
 #endif
 
+#ifdef USE_SSLEAY
+/* "global" init done? */
+static int init_ssl=0;
+#endif
+
 /* Global init */
 void Curl_SSL_init(void)
 {
 #ifdef USE_SSLEAY
-  static int only_once=0;
 
   /* make sure this is only done once */
-  if(0 != only_once)
+  if(0 != init_ssl)
     return;
 
-  only_once++; /* never again */
+  init_ssl++; /* never again */
 
   /* Lets get nice error messages */
   SSL_load_error_strings();
@@ -259,12 +263,16 @@ void Curl_SSL_init(void)
 void Curl_SSL_cleanup(void)
 {
 #ifdef USE_SSLEAY
-  /* Free the SSL error strings */
-  ERR_free_strings();
+  if(init_ssl) {
+    /* only cleanup if we did a previous init */
+
+    /* Free the SSL error strings */
+    ERR_free_strings();
   
-  /* EVP_cleanup() removes all ciphers and digests from the
-     table. */
-  EVP_cleanup();
+    /* EVP_cleanup() removes all ciphers and digests from the
+       table. */
+    EVP_cleanup();
+  }
 #endif  
 }