4 ms·
libcurl is part of the macOS API and de-facto standard on any Linux box and commonly available on BSD boxen as well. Microsoft has been shipping curl.exe for a
by formerly_proven 2y ago
libcurl is part of the macOS API and de-facto standard on any Linux box and commonly available on BSD boxen as well. Microsoft has been shipping curl.exe for a while as well, though not the library.
If Microsoft would also ship the library in %system32%, we would have a truly cross-platform and stable, OS-provided and -patched high-level network protocol client.
(So that probably won't happen)
- pjmlp 2y agoThere are more OSes out there. I never needed curl on Windows, because on OSes that provide a full stack developer experience such things are part of the platform SDK, and rich language runtimes. It is only an issue with C and C++, and their reliance on POSIX to complement the slim standard library, effectively making UNIX their "runtime" for all practical purposes.
- fallingsquirrel 2y agoYou missed the point. There are more OSes out there. If you had to relearn a brand new "full stack experience" for every OS just to ship a cross-platform app, you wouldn't have any time left for business logic. libcurl is great and it runs everywhere. And now for a personal opinion: I'll take libcurl over .NET's IHttpClientFactory any day.
- pjmlp 2y agoI have been programming since the glory days of 8 bit home computers, try shipping cross-platform applications in Z80 and 6502, and we still had plenty of time left to do lots of stuff. Additionally, writing little wrappers around OS APIs is something that every C programmer has known since K&R C went outside UNIX V6, which again is why POSIX became a thing.
- neonsunset 2y agoWhat? You don't need to use it explicitly most of the time. Just `new HttpClient` and cache/dispose it. Or have DI inject it for you. It will do the right thing without further input. The reason for this factory existing is pooling the underlying HttpMessageHandlers which hold an internal connection pool for efficient connection/stream(in case of HTTP2 or Quic) reuse for large applications which use DI.
- actionfromafar 2y agoHm, since a DLL is a PE file and EXE is a PE file, could one load the EXE as a DLL instead? Edit, I had a recollection I saw something like that before, this might be that: https://www.codeproject.com/articles/1045674/load-exe-as-dll-mission-possible https://www.codeproject.com/articles/1045674/load-exe-as-dll...
- Pathogen-David 2y agoI just checked and the curl.exe on my system does not export any symbols, so not in this case. It is possible to do that in the general sense though.
- deleted 2y ago[deleted]
- hypeatei 2y ago> Microsoft has been shipping curl.exe for a while as well, though not the library. I'm not sure if this is accurate. Why do they include a default alias in Powershell for `curl` that points to the `Invoke-WebRequest` cmdlet then? I've always installed curl myself and removed the alias on Windows. Maybe I've never noticed the default one because of that.
- easton 2y agoAs of one of the later releases of Windows 10, "curl.exe" is in System32 (or somewhere else on PATH), but if you type "curl" in a powershell you get the alias. You need to type "curl.exe" to get the binary. Guessing this is for backwards compatibility with scripts written for the days when it was just PowerShell lying to you. https://curl.se/windows/microsoft.html https://curl.se/windows/microsoft.html
- jasomill 2y agocurl.exe does ship with Windows. Given a Windows 11 ISO freshly downloaded from microsoft.com, we have $ 7z l /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim | egrep ' 1/Windows/Sys.*/curl.exe' 2024-09-06 00:02:14 ....A 672312 343918 1/Windows/System32/curl.exe 2024-09-06 00:02:14 ....A 585160 323710 1/Windows/SysWOW64/curl.exe This is, in fact, curl: > C:\Windows\System32\curl.exe --version curl 8.9.1 (Windows) libcurl/8.9.1 Schannel zlib/1.3 WinIDN Release-Date: 2024-07-31 Protocols: dict file ftp ftps http https imap imaps ipfs ipns mqtt pop3 pop3s smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets My personal favorite *nix utility nobody knows ships with Windows is tar.exe, which is libarchive's bsdtar and therefore supports a wide variety of archive formats. ["1/…" is 7z syntax for the first image in the WIM file — Windows 11 Home, in this example — included here to avoid redundant output; curl.exe is included in all images. "…/SysWOW64/curl.exe" is a 32-bit curl build (32-bit Windows programs see "Windows\SysWOW64" as "Windows\System32").]
- formerly_proven 2y ago> My personal favorite *nix utility nobody knows ships with Windows is tar.exe, which is libarchive's bsdtar and therefore supports a wide variety of archive formats. TIL. However, some caveats: https://github.com/libarchive/libarchive/issues/2092 https://github.com/libarchive/libarchive/issues/2092