2 ms·
Backblaze CTO here.... > I found libcurl difficult to use in 'C' Umm.... it is literally the most simple API that could possibly exist? Here are the four lin
by brianwski 7y ago
Backblaze CTO here....
> I found libcurl difficult to use in 'C'
Umm.... it is literally the most simple API that could possibly exist? Here are the four lines in 'C' to fetch a URL:
curl_global_init(CURL_GLOBAL_SSL); // do this once inside of "main()"
CURL ch = curl_easy_init();
curl_easy_setopt(ch, CURLOPT_URL, "http://www.google.com"); http://www.google.com");
int res = curl_easy_perform(ch);
I'm not sure how you could fetch a URL without initializing the library or specifying the URL?? It is like profoundly the most simple API that could possibly exist, I challenge you to specify any imagined API that is shorter or more simple or more straight-forward??!
The nice thing about the libcurl API is the above works and is the "base" concept, but if you want to specify something like a "network throttle" to be polite to other things on the network, you just start adding one extra line at a time to the above code:
curl_easy_setopt(ch, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) (256 * 1024)); // 256 kbits/sec
- rlonn 7y agoI founded an online load testing company called Load Impact, and we have also used libcurl since way back. I agree the API is very simple, and libcurl is a very reliable and performant piece of software. Daniel is also extremely helpful while not charging a penny for all the time he puts in. It's a great idea, this "paying back" accumulated moral debt (or whatever you'd like to call it) to open source developers whose software you've built a successful business on. Applauds to you, and to Backblaze! I am not running Load Impact anymore, but will see if we can follow Backblaze's lead here and do something similar.