Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions project.janet
Original file line number Diff line number Diff line change
Expand Up @@ -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/" }
})

Expand Down Expand Up @@ -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))
Expand Down