summaryrefslogtreecommitdiff
path: root/tests/libtest/lib1915.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtest/lib1915.c')
-rw-r--r--tests/libtest/lib1915.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/libtest/lib1915.c b/tests/libtest/lib1915.c
index 2bd6ffce8..329f35453 100644
--- a/tests/libtest/lib1915.c
+++ b/tests/libtest/lib1915.c
@@ -65,6 +65,16 @@ static CURLSTScode hstsread(CURL *easy, struct curl_hstsentry *e,
return CURLSTS_OK;
}
+/* verify error from callback */
+static CURLSTScode hstsreadfail(CURL *easy, struct curl_hstsentry *e,
+ void *userp)
+{
+ (void)easy;
+ (void)e;
+ (void)userp;
+ return CURLSTS_FAIL;
+}
+
/* check that we get the hosts back in the save */
static CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *e,
struct curl_index *i, void *userp)
@@ -97,6 +107,19 @@ int test(char *URL)
curl_easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
+ printf("First request returned %d\n", (int)ret);
+ }
+ hnd = curl_easy_init();
+ if(hnd) {
+ curl_easy_setopt(hnd, CURLOPT_URL, URL);
+ curl_easy_setopt(hnd, CURLOPT_HSTSREADFUNCTION, hstsreadfail);
+ curl_easy_setopt(hnd, CURLOPT_HSTSREADDATA, &st);
+ curl_easy_setopt(hnd, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
+ curl_easy_setopt(hnd, CURLOPT_HSTSWRITEDATA, &st);
+ curl_easy_setopt(hnd, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
+ ret = curl_easy_perform(hnd);
+ curl_easy_cleanup(hnd);
+ printf("Second request returned %d\n", (int)ret);
}
curl_global_cleanup();
return (int)ret;