drop cast for CURLHSTS_ENABLE docs/examples, sync #define in docs

This commit is contained in:
Viktor Szakats 2025-07-01 15:19:38 +02:00
parent 0867a9d9f7
commit 9e243ae651
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 4 additions and 4 deletions

View file

@ -87,7 +87,7 @@ int main(void)
struct state st = {0};
/* enable HSTS for this handle */
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
/* function to call at first to populate the cache before the transfer */
curl_easy_setopt(curl, CURLOPT_HSTSREADFUNCTION, hstsread);

View file

@ -23,8 +23,8 @@ CURLOPT_HSTS_CTRL - control HSTS behavior
~~~c
#include <curl/curl.h>
#define CURLHSTS_ENABLE (1<<0)
#define CURLHSTS_READONLYFILE (1<<1)
#define CURLHSTS_ENABLE (long)(1<<0)
#define CURLHSTS_READONLYFILE (long)(1<<1)
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask);
~~~
@ -64,7 +64,7 @@ int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
curl_easy_perform(curl);
}
}