diff --git a/http.c b/http.c index 84e119c..7251495 100644 --- a/http.c +++ b/http.c @@ -169,7 +169,14 @@ static Janet c_send_request(int32_t argc, Janet *argv) { // response headers curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_callback); curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *)&headers); - + + // set SSL behavior options + // + // Tell libcurl to use the operating system's native CA store for certificate verification. + // Works only on Windows when built to use OpenSSL. + // This option is experimental and behavior is subject to change. (Added in 7.71.0) + curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA); + // send request res = curl_easy_perform(curl); @@ -186,7 +193,7 @@ static Janet c_send_request(int32_t argc, Janet *argv) { janet_table_put(response_table, janet_ckeywordv("body"), janet_wrap_string(janet_string((const uint8_t *)body.memory, body.size))); janet_table_put(response_table, janet_ckeywordv("headers"), janet_wrap_string(janet_string((const uint8_t *)headers.memory, headers.size))); } - + /* cleanup */ curl_easy_cleanup(curl); curl_slist_free_all(curl_slist); diff --git a/project.janet b/project.janet index 9adfa5f..c21d4d7 100644 --- a/project.janet +++ b/project.janet @@ -11,12 +11,12 @@ :x64 { :download-url "https://curl.se/windows/dl-7.75.0_4/curl-7.75.0_4-win64-mingw.zip" :lib-path "./curl/curl-7.75.0-win64-mingw/lib/" - :bin-files "./curl/curl-7.75.0-win64-mingw/bin/libcurl-x64*" + :bin-path "./curl/curl-7.75.0-win64-mingw/bin/" :include-path "./curl/curl-7.75.0-win64-mingw/include/" } :x86 { :download-url "https://curl.se/windows/dl-7.75.0_4/curl-7.75.0_4-win32-mingw.zip" :lib-path "./curl/curl-7.75.0-win32-mingw/lib/" - :bin-files "./curl/curl-7.75.0-win32-mingw/bin/libcurl*" + :bin-path "./curl/curl-7.75.0-win32-mingw/bin/" :include-path "./curl/curl-7.75.0-win32-mingw/include/" } }) @@ -56,7 +56,7 @@ "Expand-Archive -Force -Path curl.zip -DestinationPath curl"] :p)) (defn windows-install-curl-dlls [] - (def dll-files (string/replace-all "/" "\\" (curl-paths :bin-files))) + (def dll-files (string/replace-all "/" "\\" (curl-paths :bin-path "libcurl-x64*"))) (print "copy " dll-files " to " JANET_BINPATH) (os/execute ["cmd.exe" "/c" "copy" dll-files JANET_BINPATH] :p))