CURLOPT_HSTSWRITEDATA(3)

πŸ’… CURLOPT_HSTSWRITEDATA(3) πŸ’…

okay so bestie, welcome to the CURLOPT_HSTSWRITEDATA page from the libcurl Library Functions Manual ✨ this one is short, sweet, and extremely β€œpass the pointer, bestie” energy.

🌸 NAME 🌸

CURLOPT_HSTSWRITEDATA β€” pointer passed to the HSTS write callback πŸ’«

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

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

πŸ’– DESCRIPTION πŸ’–

It’s the data pointer to pass to the HSTS write function, bestie. If you’re using the CURLOPT_HSTSWRITEFUNCTION(3) option, this is literally the pointer you get as input in the fourth argument to the callback 🫢

⚠️ ok important: this option does not enable HSTS. You need to use CURLOPT_HSTS_CTRL(3) to do that. no cap, don’t forget it πŸ’€

πŸŽ€ DEFAULT πŸŽ€

  • NULL β€” that’s the whole default, bestie πŸ•³οΈ

🌈 PROTOCOLS 🌈

  • This functionality affects http only πŸ¦‹

✨ 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_HSTSWRITEFUNCTION callback */
    curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &this);

    curl_easy_perform(curl);
  }
}

πŸ”₯ AVAILABILITY πŸ”₯

  • Added in curl 7.74.0 πŸŽ€

πŸ‘‘ RETURN VALUE πŸ‘‘

  • This returns CURLE_OK πŸ‘‘ that’s it, that’s the vibe.

🫢 SEE ALSO 🫢


later, bestie 🫢 β€” this page came from libcurl and is dated 2026-10-12. mwah πŸ’‹

πŸ“¦ where this page comes from