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