Re: Why?
so far as I can tell libcurl is a library that exposes the curl program's functionality to C code
It's more that curl is a command-line interface to libcurl.
If you're writing code for a Unix-like system then you certainly know that reading from a socket and writing to a file descriptor is no big deal.
But a great many people get it wrong nonetheless. I have seen far too many misuses and abuses of the socket API (and the name resolver API, etc) to think this is a good idea.
And more important, HTTP is no longer a trivial protocol. Yes, if you only need to fetch something once in a while, you can probably get away with just implementing client-side HTTP/1.0. But it won't do for anything ambitious, and any version of HTTP beyond that is significantly harder to get right (particularly regarding security).
And then there's TLS, and no one is competent implement TLS. (If you're one of the exceptions to this rule, you already know that you shouldn't implement TLS either. There are very, very few people who should even try to implement TLS.)
Now, all that said, it's a terrible example. Searching GitHub for code that calls libcurl will very likely give you examples of using libcurl poorly. And you won't learn anything from copying them. The only way to use libcurl properly is to understand the protocols it implements, and then its API and architecture. If you can't write it yourself with nothing beyond the occasional reference to the libcurl documentation, you need to put the API down and back away slowly.
Source-code search, like Copilot, is just another form of learned helplessness and a way to encourage the worst development practices. It optimizes for bad behavior.