summaryrefslogtreecommitdiff
path: root/include/curl/curl.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-11-02 23:17:01 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-11-03 16:08:48 +0100
commit2cfc4ed98347047249b8f7f91ad513a4b0b84e45 (patch)
tree6e69f05aeeb76db0a7f15f9c8314f1e983ed42e8 /include/curl/curl.h
parent7385610d0c74c6a254fea5e4cd6e1d559d848c8c (diff)
downloadcurl-2cfc4ed98347047249b8f7f91ad513a4b0b84e45.tar.gz
hsts: add read/write callbacks
- read/write callback options - man pages for the 4 new setopts - test 1915 verifies the callbacks Closes #5896
Diffstat (limited to 'include/curl/curl.h')
-rw-r--r--include/curl/curl.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h
index 568408942..8d9c72a59 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -954,6 +954,33 @@ typedef enum {
#define CURLALTSVC_H2 (1<<4)
#define CURLALTSVC_H3 (1<<5)
+
+struct curl_hstsentry {
+ char *name;
+ size_t namelen;
+ unsigned int includeSubDomains:1;
+ char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */
+};
+
+struct curl_index {
+ size_t index; /* the provided entry's "index" or count */
+ size_t total; /* total number of entries to save */
+};
+
+typedef enum {
+ CURLSTS_OK,
+ CURLSTS_DONE,
+ CURLSTS_FAIL
+} CURLSTScode;
+
+typedef CURLSTScode (*curl_hstsread_callback)(CURL *easy,
+ struct curl_hstsentry *e,
+ void *userp);
+typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy,
+ struct curl_hstsentry *e,
+ struct curl_index *i,
+ void *userp);
+
/* CURLHSTS_* are bits for the CURLOPT_HSTS option */
#define CURLHSTS_ENABLE (long)(1<<0)
#define CURLHSTS_READONLYFILE (long)(1<<1)
@@ -2038,6 +2065,14 @@ typedef enum {
/* HSTS file name */
CURLOPT(CURLOPT_HSTS, CURLOPTTYPE_STRINGPOINT, 300),
+ /* HSTS read callback */
+ CURLOPT(CURLOPT_HSTSREADFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 301),
+ CURLOPT(CURLOPT_HSTSREADDATA, CURLOPTTYPE_CBPOINT, 302),
+
+ /* HSTS write callback */
+ CURLOPT(CURLOPT_HSTSWRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 303),
+ CURLOPT(CURLOPT_HSTSWRITEDATA, CURLOPTTYPE_CBPOINT, 304),
+
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;