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