mirror of
https://github.com/moparisthebest/curl
synced 2025-03-01 01:41:50 -05:00
curl_global_init() support for CURL_GLOBAL_NOT_SSL
This commit is contained in:
parent
285e998fae
commit
b541537c66
@ -573,6 +573,9 @@ typedef enum {
|
|||||||
CURLCLOSEPOLICY_LAST /* last, never use this */
|
CURLCLOSEPOLICY_LAST /* last, never use this */
|
||||||
} curl_closepolicy;
|
} curl_closepolicy;
|
||||||
|
|
||||||
|
#define CURL_GLOBAL_NOT_SSL (1<<0)
|
||||||
|
#define CURL_GLOBAL_NOTHING CURL_GLOBAL_NOT_SSL
|
||||||
|
#define CURL_GLOBAL_DEFAULT 0
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,9 @@
|
|||||||
|
|
||||||
CURLcode curl_global_init(long flags)
|
CURLcode curl_global_init(long flags)
|
||||||
{
|
{
|
||||||
flags = 0; /* not currently used */
|
if(!(flags & CURL_GLOBAL_NOT_SSL))
|
||||||
Curl_SSL_init();
|
Curl_SSL_init();
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
lib/ssluse.c
14
lib/ssluse.c
@ -235,17 +235,21 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_SSLEAY
|
||||||
|
/* "global" init done? */
|
||||||
|
static int init_ssl=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Global init */
|
/* Global init */
|
||||||
void Curl_SSL_init(void)
|
void Curl_SSL_init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SSLEAY
|
#ifdef USE_SSLEAY
|
||||||
static int only_once=0;
|
|
||||||
|
|
||||||
/* make sure this is only done once */
|
/* make sure this is only done once */
|
||||||
if(0 != only_once)
|
if(0 != init_ssl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
only_once++; /* never again */
|
init_ssl++; /* never again */
|
||||||
|
|
||||||
/* Lets get nice error messages */
|
/* Lets get nice error messages */
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
@ -259,12 +263,16 @@ void Curl_SSL_init(void)
|
|||||||
void Curl_SSL_cleanup(void)
|
void Curl_SSL_cleanup(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SSLEAY
|
#ifdef USE_SSLEAY
|
||||||
|
if(init_ssl) {
|
||||||
|
/* only cleanup if we did a previous init */
|
||||||
|
|
||||||
/* Free the SSL error strings */
|
/* Free the SSL error strings */
|
||||||
ERR_free_strings();
|
ERR_free_strings();
|
||||||
|
|
||||||
/* EVP_cleanup() removes all ciphers and digests from the
|
/* EVP_cleanup() removes all ciphers and digests from the
|
||||||
table. */
|
table. */
|
||||||
EVP_cleanup();
|
EVP_cleanup();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user