If you need to send HTTPS requests from native code, there are
benefits to using the platform provided HTTP client compared to a
cross platform implementation like libcurl.
The platform HTTP client and cryptography libraries are actively maintained and updated by the OS. This reduces the maintenance burden, especially with how often security patches are released.
Another benefit is that it may be more efficient to use the specific platform HTTP stack, as that's usually optimized for the platform.
So if this approach fits your use case, you should use a library that acts as a thin API layer over the platform stack.
Such projects already exist, but unfortunately they appear to be inactive:
It would be an interesting project to POC, especially with the help of an AI agent. I'll list a few points I think should be considered when attempting this.
Platform coverage
On MacOS and iOS you can use NSURLSession.
On Android you can provide the JavaVM* handle to the
native code and call a Java based implementation using JNI. The
Android
docs
provide a few options to choose from. For example,
HttpsURLConnection.
Developing on Windows
is a mess
(via), but you can probably use Windows.Web.Http.HttpClient
(docs)
Since Linux is so customizable, you aren't really guaranteed to have
any specific HTTP client library installed on the platform, but
usually libcurl is a good bet here.
WebAssembly adoption is pretty good on the web. With some limitations,
the library can also support running on client side inside a browser.
The Emscripten implementation can use a fetch backend
(docs).