4 ms·
Is curl API that good? It looks a little weird to me, for example, you need to set URL as an "option", and it is not "optional" despite the name. Wouldn't it be
by codedokode 2y ago
Is curl API that good? It looks a little weird to me, for example, you need to set URL as an "option", and it is not "optional" despite the name. Wouldn't it be better to pass URL and method to "curl_easy_perform" function?
Furthermore, it seems to use "set option" function with magic values to control in-memory cookie storage which is even weirder: https://curl.se/libcurl/c/CURLOPT_COOKIELIST.html https://curl.se/libcurl/c/CURLOPT_COOKIELIST.html
Also, curl seems to have no built-in function to save data? The user has to implement write callback themselves?
Also, regarding options, curl uses a single function for setting options of different types (numbers, booleans, strings) so typing for an option value cannot be used. Is that a good idea? What C developers usually use in such cases?
- dncornholio 2y agoWhy should a transport library deal with storing data? And you can crique the design I guess, but it works and it works well. Sometimes that is enough.
- cqqxo4zV46cp 2y agoYour unfamiliarity with C aside, curl is more than its API.
- Sharlin 2y agoUnfortunately C libraries aren't known for their use of strong typing or the "make invalid states unrepresentable" paradigm, and C itself is very weakly typed so it's not even feasible to write strongly typesafe APIs in C.