1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_HSTSWRITEDATA
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_HSTS (3)
9  - CURLOPT_HSTSREADDATA (3)
10  - CURLOPT_HSTSREADFUNCTION (3)
11  - CURLOPT_HSTSWRITEFUNCTION (3)
12---
13
14# NAME
15
16CURLOPT_HSTSWRITEDATA - pointer passed to the HSTS write callback
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSWRITEDATA, void *pointer);
24~~~
25
26# DESCRIPTION
27
28Data *pointer* to pass to the HSTS write function. If you use the
29CURLOPT_HSTSWRITEFUNCTION(3) option, this is the pointer you get as
30input in the fourth argument to the callback.
31
32This option does not enable HSTS, you need to use CURLOPT_HSTS_CTRL(3) to
33do that.
34
35# DEFAULT
36
37NULL
38
39# PROTOCOLS
40
41This feature is only used for HTTP(S) transfer.
42
43# EXAMPLE
44
45~~~c
46struct MyData {
47  void *custom;
48};
49
50int main(void)
51{
52  CURL *curl = curl_easy_init();
53  struct MyData this;
54  if(curl) {
55    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
56
57    /* pass pointer that gets passed in to the
58       CURLOPT_HSTSWRITEFUNCTION callback */
59    curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &this);
60
61    curl_easy_perform(curl);
62  }
63}
64~~~
65
66# AVAILABILITY
67
68Added in 7.74.0
69
70# RETURN VALUE
71
72This returns CURLE_OK.
73