GNURLOPT_MAX_SEND_SPEED_LARGE(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLOPT_MAX_SEND_SPEED_LARGE(3) πŸ’…

okay so bestie, this page lives in the curl_easy_setopt options part of the gnurl manual β€” it's the one titled GNURLOPT_MAX_SEND_SPEED_LARGE(3), and it's literally all about not letting your uploads go feral. 🐎


✨ NAME ✨

CURLOPT_MAX_SEND_SPEED_LARGE β€” rate limit data upload speed 🚦


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_SEND_SPEED_LARGE,
                          curl_off_t maxspeed);

πŸ¦‹ DESCRIPTION πŸ¦‹

You pass a curl_off_t in as the maxspeed. If an upload ever exceeds that speed (and yes, it's counted in bytes per second), the transfer will pause so the speed stays less than or equal to whatever value you handed over. Defaults to unlimited speed, iykyk. πŸ’–

Heads up though β€” this is not an exact science. libcurl attempts to keep the average speed below the given threshold over a period of time. So it's giving "best effort," not "precision instrument." 😭

And if you set maxspeed to a value lower than CURLOPT_UPLOAD_BUFFERSIZE(3), libcurl might "shoot over" the limit on its first send and still send off a full buffer. Ngl, it happens. πŸ’€

Also important: this option doesn't affect transfer speeds done with FILE:// URLs. Periodt.

🌸 DEFAULT 🌸

0, disabled ✨


🌈 PROTOCOLS 🌈

All except file:// 🚫


πŸ”₯ EXAMPLE πŸ”₯

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode ret;
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  /* cap the upload speed to 1000 bytes/sec */
  curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)1000);
  /* (set some upload options as well!) */
  ret = curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.15.5 πŸŽ‰


πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Simple as that, bestie. 🫢


🧚 SEE ALSO 🧚


okay that's the whole page, no cap πŸ’… β€” this was brought to you by libcurl 7.37.0, dated 19 Jun 2014, from the GNURLOPT_M...SPEED_LARGE(3) corner of the manual. go throttle those uploads responsibly, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from