diff --git a/lib/share.c b/lib/share.c
index a3db4de..63b9302 100644
--- a/lib/share.c
+++ b/lib/share.c
@@ -25,6 +25,7 @@
 #include <curl/curl.h>
 #include "urldata.h"
 #include "share.h"
+#include "ssluse.h"
 #include "curl_memory.h"
 
 /* The last #include file should be: */
@@ -82,7 +83,15 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
       break;
 #endif   /* CURL_DISABLE_HTTP */
 
-    case CURL_LOCK_DATA_SSL_SESSION: /* not supported (yet) */
+    case CURL_LOCK_DATA_SSL_SESSION:
+      if(!share->sslsession) {
+        share->nsslsession = 8;
+        share->sslsession = calloc(share->nsslsession, sizeof(struct curl_ssl_session));
+        if(!share->sslsession)
+          return CURLSHE_NOMEM;
+      }
+      break;
+
     case CURL_LOCK_DATA_CONNECT:     /* not supported (yet) */
 
     default:
@@ -112,6 +121,11 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
 #endif   /* CURL_DISABLE_HTTP */
 
     case CURL_LOCK_DATA_SSL_SESSION:
+      if(share->sslsession) {
+        free(share->sslsession);
+        share->sslsession = NULL;
+        share->nsslsession = 0;
+      }
       break;
 
     case CURL_LOCK_DATA_CONNECT:
@@ -148,6 +162,7 @@ CURLSHcode
 curl_share_cleanup(CURLSH *sh)
 {
   struct Curl_share *share = (struct Curl_share *)sh;
+  int i;
 
   if(share == NULL)
     return CURLSHE_INVALID;
@@ -170,6 +185,12 @@ curl_share_cleanup(CURLSH *sh)
   if(share->cookies)
     Curl_cookie_cleanup(share->cookies);
 
+  if(share->sslsession) {
+    for(i = 0; i < share->nsslsession; ++i)
+      Curl_ssl_kill_session(&(share->sslsession[i]));
+    free(share->sslsession);
+  }
+
   if(share->unlockfunc)
     share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
   free(share);
diff --git a/lib/share.h b/lib/share.h
index ea8e233..cf20000 100644
--- a/lib/share.h
+++ b/lib/share.h
@@ -26,6 +26,7 @@
 #include "setup.h"
 #include <curl/curl.h>
 #include "cookie.h"
+#include "urldata.h"
 
 /* SalfordC says "A structure member may not be volatile". Hence:
  */
@@ -46,6 +47,9 @@ struct Curl_share {
 
   struct curl_hash *hostcache;
   struct CookieInfo *cookies;
+
+  struct curl_ssl_session *sslsession;
+  unsigned int nsslsession;
 };
 
 CURLSHcode Curl_share_lock (struct SessionHandle *, curl_lock_data,
diff --git a/lib/sslgen.c b/lib/sslgen.c
index fbdbeea..2d64df4 100644
--- a/lib/sslgen.c
+++ b/lib/sslgen.c
@@ -62,6 +62,7 @@
 #include "url.h"
 #include "curl_memory.h"
 #include "progress.h"
+#include "share.h"
 /* The last #include file should be: */
 #include "memdebug.h"
 
@@ -260,7 +261,7 @@ int Curl_ssl_getsessionid(struct connectdata *conn,
 /*
  * Kill a single session ID entry in the cache.
  */
-static int kill_session(struct curl_ssl_session *session)
+int Curl_ssl_kill_session(struct curl_ssl_session *session)
 {
   if(session->sessionid) {
     /* defensive check */
@@ -292,7 +293,7 @@ void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid)
     struct curl_ssl_session *check = &conn->data->state.session[i];
 
     if(check->sessionid == ssl_sessionid) {
-      kill_session(check);
+      Curl_ssl_kill_session(check);
       break;
     }
   }
@@ -335,7 +336,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
   }
   if(i == data->set.ssl.numsessions)
     /* cache is full, we must "kill" the oldest entry! */
-    kill_session(store);
+    Curl_ssl_kill_session(store);
   else
     store = &data->state.session[i]; /* use this slot */
 
@@ -363,10 +364,11 @@ void Curl_ssl_close_all(struct SessionHandle *data)
 {
   long i;
   /* kill the session ID cache */
-  if(data->state.session) {
+  if(data->state.session &&
+     !(data->share && data->share->sslsession == data->state.session)) {
     for(i=0; i< data->set.ssl.numsessions; i++)
       /* the single-killer function handles empty table slots */
-      kill_session(&data->state.session[i]);
+      Curl_ssl_kill_session(&data->state.session[i]);
 
     /* free the cache data */
     free(data->state.session);
diff --git a/lib/sslgen.h b/lib/sslgen.h
index b0a0fab..4c317fc 100644
--- a/lib/sslgen.h
+++ b/lib/sslgen.h
@@ -63,6 +63,8 @@ int Curl_ssl_getsessionid(struct connectdata *conn,
 CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
                                void *ssl_sessionid,
                                size_t idsize);
+/* Kill a single session ID entry in the cache */
+int Curl_ssl_kill_session(struct curl_ssl_session *session);
 /* delete a session from the cache */
 void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);
 
diff --git a/lib/url.c b/lib/url.c
index 59da3e9..a97537a 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2085,6 +2085,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
       if(data->share->cookies == data->cookies)
         data->cookies = NULL;
 
+      if(data->share->sslsession == data->state.session) {
+        data->state.session = NULL;
+        data->set.ssl.numsessions = 0;
+      }
+
       data->share->dirty--;
 
       Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
@@ -2116,6 +2121,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
         data->cookies = data->share->cookies;
       }
 #endif   /* CURL_DISABLE_HTTP */
+      if(data->share->sslsession) {
+        data->set.ssl.numsessions = data->share->nsslsession;
+        data->state.session = data->share->sslsession;
+      }
       Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
 
     }

