diff options
Diffstat (limited to 'lib/share.c')
-rw-r--r-- | lib/share.c | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/lib/share.c b/lib/share.c index 33dcecf4c..71c2ef308 100644 --- a/lib/share.c +++ b/lib/share.c @@ -21,12 +21,11 @@ ***************************************************************************/ #include "setup.h" -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> + #include <curl/curl.h> #include "urldata.h" #include "share.h" +#include "sslgen.h" #include "curl_memory.h" /* The last #include file should be: */ @@ -74,17 +73,32 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) } break; -#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) case CURL_LOCK_DATA_COOKIE: +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) if(!share->cookies) { share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE ); if(!share->cookies) return CURLSHE_NOMEM; } break; -#endif /* CURL_DISABLE_HTTP */ +#else /* CURL_DISABLE_HTTP */ + return CURLSHE_NOT_BUILT_IN; +#endif + + case CURL_LOCK_DATA_SSL_SESSION: +#ifdef USE_SSL + if(!share->sslsession) { + share->nsslsession = 8; + share->sslsession = calloc(share->nsslsession, + sizeof(struct curl_ssl_session)); + if(!share->sslsession) + return CURLSHE_NOMEM; + } + break; +#else + return CURLSHE_NOT_BUILT_IN; +#endif - case CURL_LOCK_DATA_SSL_SESSION: /* not supported (yet) */ case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */ default: @@ -104,17 +118,28 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) } break; -#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) case CURL_LOCK_DATA_COOKIE: +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) if(share->cookies) { Curl_cookie_cleanup(share->cookies); share->cookies = NULL; } break; -#endif /* CURL_DISABLE_HTTP */ +#else /* CURL_DISABLE_HTTP */ + return CURLSHE_NOT_BUILT_IN; +#endif case CURL_LOCK_DATA_SSL_SESSION: +#ifdef USE_SSL + if(share->sslsession) { + free(share->sslsession); + share->sslsession = NULL; + share->nsslsession = 0; + } break; +#else + return CURLSHE_NOT_BUILT_IN; +#endif case CURL_LOCK_DATA_CONNECT: break; @@ -169,8 +194,19 @@ curl_share_cleanup(CURLSH *sh) share->hostcache = NULL; } +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) if(share->cookies) Curl_cookie_cleanup(share->cookies); +#endif + +#ifdef USE_SSL + if(share->sslsession) { + unsigned int i; + for(i = 0; i < share->nsslsession; ++i) + Curl_ssl_kill_session(&(share->sslsession[i])); + free(share->sslsession); + } +#endif if(share->unlockfunc) share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata); |