summaryrefslogtreecommitdiff
path: root/lib/share.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2018-05-28 20:29:15 +0200
committerPatrick Monnerat <patrick@monnerat.net>2018-05-28 20:37:14 +0200
commit8541d02c967c993f6e36fd78c59c50b70315ac91 (patch)
treed3084a668426bd32295cd7acf517e934670317c1 /lib/share.c
parent536e9f828997c39d67fcf09cb3b2c19d4cf216cc (diff)
downloadcurl-8541d02c967c993f6e36fd78c59c50b70315ac91.tar.gz
psl: use latest psl and refresh it periodically
The latest psl is cached in the multi or share handle. It is refreshed before use after 72 hours. New share lock CURL_LOCK_DATA_PSL controls the psl cache sharing. If the latest psl is not available, the builtin psl is used. Reported-by: Yaakov Selkowitz Fixes #2553 Closes #2601
Diffstat (limited to 'lib/share.c')
-rw-r--r--lib/share.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/share.c b/lib/share.c
index 870b191fc..3d5108610 100644
--- a/lib/share.c
+++ b/lib/share.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -25,6 +25,7 @@
#include <curl/curl.h>
#include "urldata.h"
#include "share.h"
+#include "psl.h"
#include "vtls/vtls.h"
#include "curl_memory.h"
@@ -106,6 +107,12 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
res = CURLSHE_NOMEM;
break;
+ case CURL_LOCK_DATA_PSL:
+#ifndef USE_LIBPSL
+ res = CURLSHE_NOT_BUILT_IN;
+#endif
+ break;
+
default:
res = CURLSHE_BAD_OPTION;
}
@@ -205,6 +212,8 @@ curl_share_cleanup(struct Curl_share *share)
}
#endif
+ Curl_psl_destroy(&share->psl);
+
if(share->unlockfunc)
share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
free(share);