Skip to content

Commit d91b86b

Browse files
Revert "build(deps): migrate from curl to curl-winssl on Windows (#3246)"
This reverts commit 9cc8bc8, should resolve #91
1 parent dcbed39 commit d91b86b

File tree

3 files changed

+36
-32
lines changed

3 files changed

+36
-32
lines changed

.codeql-prebuild-cpp-Windows.sh

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,43 @@
22
set -e
33

44
# update pacman
5-
pacman --noconfirm -Syu
5+
pacman --noconfirm -Suy
6+
7+
# install wget
8+
pacman --noconfirm -S \
9+
wget
10+
11+
# download working curl
12+
wget https://repo.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst
613

714
# install dependencies
8-
dependencies=(
9-
"git"
10-
"mingw-w64-ucrt-x86_64-boost"
11-
"mingw-w64-ucrt-x86_64-cmake"
12-
"mingw-w64-ucrt-x86_64-cppwinrt"
13-
"mingw-w64-ucrt-x86_64-curl-winssl"
14-
"mingw-w64-ucrt-x86_64-miniupnpc"
15-
"mingw-w64-ucrt-x86_64-nlohmann-json"
16-
"mingw-w64-ucrt-x86_64-nodejs"
17-
"mingw-w64-ucrt-x86_64-nsis"
18-
"mingw-w64-ucrt-x86_64-onevpl"
19-
"mingw-w64-ucrt-x86_64-openssl"
20-
"mingw-w64-ucrt-x86_64-opus"
21-
"mingw-w64-ucrt-x86_64-toolchain"
22-
)
23-
pacman -S --noconfirm "${dependencies[@]}"
15+
pacman -U --noconfirm mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst
16+
pacman -Syu --noconfirm --ignore=mingw-w64-ucrt-x86_64-curl \
17+
base-devel \
18+
diffutils \
19+
gcc \
20+
git \
21+
make \
22+
mingw-w64-ucrt-x86_64-cmake \
23+
mingw-w64-ucrt-x86_64-cppwinrt \
24+
mingw-w64-ucrt-x86_64-graphviz \
25+
mingw-w64-ucrt-x86_64-miniupnpc \
26+
mingw-w64-ucrt-x86_64-nlohmann-json \
27+
mingw-w64-ucrt-x86_64-nodejs \
28+
mingw-w64-ucrt-x86_64-nsis \
29+
mingw-w64-ucrt-x86_64-onevpl \
30+
mingw-w64-ucrt-x86_64-openssl \
31+
mingw-w64-ucrt-x86_64-opus \
32+
mingw-w64-ucrt-x86_64-rust \
33+
mingw-w64-ucrt-x86_64-toolchain
2434

2535
# build
2636
mkdir -p build
37+
cd build || exit 1
2738
cmake \
28-
-B build \
29-
-G Ninja \
30-
-S . \
3139
-DBUILD_DOCS=OFF \
32-
-DBUILD_WERROR=ON
33-
ninja -C build
40+
-G "MinGW Makefiles" ..
41+
mingw32-make -j"$(nproc)"
3442

3543
# skip autobuild
3644
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

docs/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ dependencies=(
8888
"mingw-w64-ucrt-x86_64-boost" # Optional
8989
"mingw-w64-ucrt-x86_64-cmake"
9090
"mingw-w64-ucrt-x86_64-cppwinrt"
91-
"mingw-w64-ucrt-x86_64-curl-winssl"
91+
"mingw-w64-ucrt-x86_64-curl"
9292
"mingw-w64-ucrt-x86_64-graphviz" # Optional, for docs
9393
"mingw-w64-ucrt-x86_64-miniupnpc"
9494
"mingw-w64-ucrt-x86_64-nlohmann-json"

src/httpcommon.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,7 @@ namespace http {
197197
bool
198198
download_file(const std::string &url, const std::string &file) {
199199
CURL *curl = curl_easy_init();
200-
if (curl) {
201-
// sonar complains about weak ssl and tls versions
202-
// ideally, the setopts should go after the early returns; however sonar cannot detect the fix
203-
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
204-
}
205-
else {
200+
if (!curl) {
206201
BOOST_LOG(error) << "Couldn't create CURL instance";
207202
return false;
208203
}
@@ -220,16 +215,17 @@ namespace http {
220215
curl_easy_cleanup(curl);
221216
return false;
222217
}
223-
224218
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
225219
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
226220
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
227-
221+
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
222+
#ifdef _WIN32
223+
curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
224+
#endif
228225
CURLcode result = curl_easy_perform(curl);
229226
if (result != CURLE_OK) {
230227
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';
231228
}
232-
233229
curl_easy_cleanup(curl);
234230
fclose(fp);
235231
return result == CURLE_OK;

0 commit comments

Comments
 (0)