CURLOPT_HSTSREADDATA(3)

πŸ’… CURLOPT_HSTSREADDATA(3) β€” the pointer you hand to your HSTS read callback

Okay bestie, welcome to another libcurl manual page, this one lives in the Library Functions Manual and it's all about CURLOPT_HSTSREADDATA β€” the little data pointer that gets passed to your HSTS read callback. πŸŽ€


✨ NAME ✨

CURLOPT_HSTSREADDATA β€” pointer passed to the HSTS read callback. that's it, that's the whole vibe.


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSREADDATA, void *pointer);

πŸ¦‹ DESCRIPTION πŸ¦‹

So picture this: it's a data pointer that you pass along to the HSTS read function. If you're using the CURLOPT_HSTSREADFUNCTION(3) option, this is literally the pointer you get as input in the 3rd argument to that callback. no middleman, no extra steps, it just shows up there. πŸ’–

⚠️ okay important thing, don't skip this: setting this option does not enable HSTS. like, at all. you need CURLOPT_HSTS_CTRL(3) for that, fr fr. this option is just the lil package you hand over, not the switch that turns stuff on. πŸ™ˆ

🧚 DEFAULT 🧚

NULL


🌈 PROTOCOLS 🌈

This functionality affects http only. that's the whole list, she's exclusive like that. πŸ‘‘


πŸ“ EXAMPLE πŸ“

struct MyData {
  void *custom;
};

int main(void)
{
  CURL *curl = curl_easy_init();
  struct MyData this;
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");

    /* pass pointer that gets passed in to the
       CURLOPT_HSTSREADFUNCTION callback */
    curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &this);

    curl_easy_perform(curl);
  }
}

see how &this just gets yeeted into the callback later? iconic behavior honestly. ✨


⭐ AVAILABILITY ⭐

Added in curl 7.74.0 β€” so if your curl is older than that, she doesn't know this option yet, sorry bestie. 😭


πŸ’œ RETURN VALUE πŸ’œ

This returns CURLE_OK. that's it. no drama, no surprises, just a clean little success. 🫢


πŸ”₯ SEE ALSO πŸ”₯


okay that's the whole page, go forth and pass your pointers responsibly πŸ’…βœ¨

mwah πŸ’‹ β€” this gem was brought to you by the fine folks of libcurl, dated 2026-10-12, and yes she's official, in the Library Functions Manual, CURLOPT_HSTSREADDATA(3) and all. slay. πŸŽ€

πŸ“¦ where this page comes from