aboutsummaryrefslogtreecommitdiff
path: root/lib/share.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-10-03 22:32:36 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-10-03 22:35:04 +0200
commit15e3e451702396e870c00d186ff7710792a1f28e (patch)
tree34e35da4099da75a29062735548773692d354d09 /lib/share.c
parent9dd85bced56f6951107f69e581c872c1e7e3e58e (diff)
share: don't use SSL unless enabled
Don't even declare the struct members for disabled features Introducing the CURLSHE_NOT_BUILT_IN return code for the share interface when trying to set a sharing option that has been disabled (or not enabled) in the library.
Diffstat (limited to 'lib/share.c')
-rw-r--r--lib/share.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/share.c b/lib/share.c
index a3eae1639..6f8ba49cd 100644
--- a/lib/share.c
+++ b/lib/share.c
@@ -73,17 +73,20 @@ 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,
@@ -92,6 +95,9 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
return CURLSHE_NOMEM;
}
break;
+#else
+ return CURLSHE_NOT_BUILT_IN;
+#endif
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
@@ -112,22 +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;
@@ -186,11 +198,13 @@ curl_share_cleanup(CURLSH *sh)
if(share->cookies)
Curl_cookie_cleanup(share->cookies);
+#ifdef USE_SSL
if(share->sslsession) {
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);