microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.31k stars 6.19k forks source link

cpr ssl broken for new cloudflare certs(discord etc) #39712

Open Chrys4lisfag opened 1 week ago

Chrys4lisfag commented 1 week ago

Describe the bug Cloudflare now issue new kind of ssl certs with no tls pin support. While doing https request to any cloudflared website with new certs, you will get internal error 4

More details in cpr issue: https://github.com/libcpr/cpr/issues/1069 This issue only appears on vcpkg version (confirmed by me as well using this example: https://github.com/libcpr/example-cmake-fetch-content, NOTE: upgrade it to latest commit) The issue author tested it for discord.gg, I have the same issue for discord and many more cloudflare websites.

Environment

To Reproduce

const cpr::Url url = cpr::Url{ "https://discord.com" };
const auto response = cpr::Get( url);

Expected behavior successful ssl verify and complete the request

Failure logs Connected to **** port 443 schannel: disabled automatic use of client certificate schannel: connection hostname () validated against certificate name () Subject: CN=**** Issuer: C=US, O=Let's Encrypt, CN=E6 Version: 2 Serial Number: 03:cf:f5:40:86:7e:2e:f9:b6:d2:e6:24:17:ff:eb:b9:58:c9: Closing connection schannel: shutting down SSL/TLS connection with t**** port 443

Additional context

jimwang118 commented 1 week ago

Which vcpkg port did you use during this process that caused this issue?

Chrys4lisfag commented 1 week ago

cpr:x64-windows-static 1.10.5#2

Chrys4lisfag commented 1 week ago

https://github.com/curl/curl/issues/13845 maybe it is related to this issue

cpr uses curl-8_7_1 while vcpkg v8.8.0 as I understand, which might be bugged

jimwang118 commented 5 days ago

I call this example: https://github.com/libcpr/example-cmake-fetch-content, and then call the following usage in cmakelists.txt, and the result is displayed normally.

 find_package(cpr CONFIG REQUIRED)
  target_link_libraries(main PRIVATE cpr::cpr)

image

Chrys4lisfag commented 5 days ago

image image

I've pulled and upgraded vcpkg rn and tested for discord.gg and github as from example. Vcpkg cpr::x64-windows-static does not work for me as you see in the screenshots above. while it works from the cpr repository(clang-llvm cmake)

Not working: vcpkg: latest(pulled today), cpr:x64-windows-static 1.10.5#2 cpr[ssl]:x64-windows-static curl:x64-windows-static 8.8.0#3

OS: Windows 10 (tested my binaries on 10+ machines in 5 different regions RU\EU\USA) compiler: Visual Studio 2022(17.10.4), c++ 20, build tools v143

example of code not working: https://github.com/Chrys4lisfag/vcpkg-cpr-issue
Also uploaded my binaries to the repo

Chrys4lisfag commented 3 days ago

Probably related https://github.com/libcpr/cpr/issues/1068