]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples/sessioninfo: do not disable security
authorViktor Szakats <commit@vsz.me>
Thu, 9 Oct 2025 10:36:43 +0000 (12:36 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 9 Oct 2025 10:59:46 +0000 (12:59 +0200)
Also make it return the curl result code.

Follow-up to df70a68984308952dcacf33d11593cb22ad80464 #18909
Closes #18969

docs/examples/sessioninfo.c

index ed5f0e9e292df661e030ba824f9009a0cc6fc742..bbdcfe8d2319aa98e780fc3ecada1a826e61c6e4 100644 (file)
@@ -96,25 +96,22 @@ static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream)
 
 int main(void)
 {
+  CURLcode res = CURLE_OK;
+
   curl_global_init(CURL_GLOBAL_DEFAULT);
 
   curl = curl_easy_init();
   if(curl) {
     curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
-
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrfu);
-
-    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
-    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
-
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
 
-    (void)curl_easy_perform(curl);
+    res = curl_easy_perform(curl);
 
     curl_easy_cleanup(curl);
   }
 
   curl_global_cleanup();
 
-  return 0;
+  return (int)res;
 }