aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/share.c22
-rw-r--r--lib/share.h6
-rw-r--r--lib/strerror.c3
3 files changed, 26 insertions, 5 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);
diff --git a/lib/share.h b/lib/share.h
index cf200008f..cb5c6c7f3 100644
--- a/lib/share.h
+++ b/lib/share.h
@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -46,9 +46,13 @@ struct Curl_share {
void *clientdata;
struct curl_hash *hostcache;
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
struct CookieInfo *cookies;
+#endif
+#ifdef USE_SSL
struct curl_ssl_session *sslsession;
+#endif
unsigned int nsslsession;
};
diff --git a/lib/strerror.c b/lib/strerror.c
index f038f8ec0..fcb617cf2 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -384,6 +384,9 @@ curl_share_strerror(CURLSHcode error)
case CURLSHE_NOMEM:
return "Out of memory";
+ case CURLSHE_NOT_BUILT_IN:
+ return "Feature not enabled in this library";
+
case CURLSHE_LAST:
break;
}