Skip to content

Commit e0c1774

Browse files
committed
use custom certificate store on windows, together with the native
1 parent 82d8faf commit e0c1774

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

loader/include/Geode/utils/web.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace geode::utils::web {
6969
/// form.param("key2", "value2");
7070
/// form.file("file", { 0xAA, 0xBB, 0xCC }, "raw.bin");
7171
/// form.file("file2", "path/to/image.png", "screenshot.png", "image/png");
72-
///
72+
///
7373
/// auto req = web::WebRequest()
7474
/// .bodyMultipart(form)
7575
/// .get(url);
@@ -286,7 +286,6 @@ namespace geode::utils::web {
286286
/**
287287
* Sets the Certificate Authority (CA) bundle content.
288288
* Defaults to sending the Geode CA bundle, found here: https://github.com/geode-sdk/net_libs/blob/main/ca_bundle.h
289-
* On Windows, defaults to using the system certificate store.
290289
*
291290
* @param content
292291
* @return WebRequest&

loader/src/utils/web.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,15 @@ WebTask WebRequest::send(std::string_view method, std::string_view url) {
475475
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
476476

477477
if (impl->m_certVerification) {
478-
#ifndef GEODE_IS_WINDOWS
479478
if (impl->m_CABundleContent.empty()) {
480479
impl->m_CABundleContent = CA_BUNDLE_CONTENT;
481480
}
482-
#endif
483481

484482
if (!impl->m_CABundleContent.empty()) {
485483
curl_blob caBundleBlob = {};
486484
caBundleBlob.data = reinterpret_cast<void*>(impl->m_CABundleContent.data());
487485
caBundleBlob.len = impl->m_CABundleContent.size();
488-
caBundleBlob.flags = CURL_BLOB_COPY;
486+
caBundleBlob.flags = CURL_BLOB_NOCOPY;
489487
curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &caBundleBlob);
490488
// Also add the native CA, for good measure
491489
curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
@@ -631,12 +629,7 @@ WebTask WebRequest::send(std::string_view method, std::string_view url) {
631629
}
632630
}
633631

634-
// Check if the response was an error code
635-
if (code >= 400 && code <= 600) {
636-
return std::move(responseData.response);
637-
}
638-
639-
// Otherwise resolve with success :-)
632+
// resolve with success :-)
640633
return std::move(responseData.response);
641634
}, fmt::format("{} {}", method, url));
642635
}

0 commit comments

Comments
 (0)