CURLOPT_TFTP_NO_OPTIONS(3)

πŸ’… CURLOPT_TFTP_NO_OPTIONS β€” the "no options, thanks" era πŸŽ€

Okay bestie, this one is from the Library Functions Manual, and it's literally about telling TFTP to chill with the option requests. Let me put you on. ✨

🌸 NAME 🌸

CURLOPT_TFTP_NO_OPTIONS β€” send no TFTP options requests. That's it. That's the whole gig. 🫢


⭐ SYNOPSIS ⭐

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff);

πŸ’œ DESCRIPTION πŸ’œ

So you set onoff to 1L and boom β€” you're excluding all the TFTP options defined in RFC 2347, RFC 2348 and RFC 2349 from your read and write requests. All of them. Not a single option. Iconic behavior honestly. πŸ‘‘

This is the move when you're dealing with legacy servers that don't acknowledge or properly implement TFTP options β€” like, this option improves interoperability with those guys. It's giving "we can't make them learn, so we'll just work around them" energy. πŸ’€

⚠️ Heads up though: when this option is used, CURLOPT_TFTP_BLKSIZE(3) is ignored. Like fully ignored. Don't come for me when your block size setting does nothing, I warned you. 😭

πŸŽ€ DEFAULT πŸŽ€

0

πŸ¦‹ PROTOCOLS πŸ¦‹

This functionality affects tftp only. Literally only tftp. Nothing else. Periodt. πŸ’…

πŸ”₯ EXAMPLE πŸ”₯

Here's the whole thing, copy it exactly bestie:

size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp)
{
  return fwrite(ptr, size, nmemb, (FILE *)fp);
}

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    FILE *fp = fopen("foo.bin", "wb");
    if(fp) {
      curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)fp);
      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);

      curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/foo.bin");

      /* do not send TFTP options requests */
      curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);

      /* Perform the request */
      curl_easy_perform(curl);

      fclose(fp);
    }
    curl_easy_cleanup(curl);
  }
}

See that little comment? /* do not send TFTP options requests */ β€” that's the whole vibe of this manpage in one line. πŸ“

🌈 AVAILABILITY 🌈

Added in curl 7.48.0 β€” so if you're on something older, sorry babe, you don't get this one. πŸ™ˆ

✨ RETURN VALUE ✨

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK β€” slay. Non-zero means an error occurred, and you should check libcurl-errors(3) for the tea. πŸ”

πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’– that's the whole page! Brought to you by the fine folks at libcurl, dated 2026-10-12, and it's CURLOPT_TFTP_NO_OPTIONS(3) all the way down. Go forth and send zero options requests, bestie. πŸ§šπŸ’œ

πŸ“¦ where this page comes from