1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_TFTP_NO_OPTIONS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_TFTP_BLKSIZE (3)
9Protocol:
10  - TFTP
11---
12
13# NAME
14
15CURLOPT_TFTP_NO_OPTIONS - send no TFTP options requests
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff);
23~~~
24
25# DESCRIPTION
26
27Set *onoff* to 1L to exclude all TFTP options defined in RFC 2347,
28RFC 2348 and RFC 2349 from read and write requests.
29
30This option improves interoperability with legacy servers that do not
31acknowledge or properly implement TFTP options. When this option is used
32CURLOPT_TFTP_BLKSIZE(3) is ignored.
33
34# DEFAULT
35
360
37
38# EXAMPLE
39
40~~~c
41size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp)
42{
43  return fwrite(ptr, size, nmemb, (FILE *)fp);
44}
45
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    FILE *fp = fopen("foo.bin", "wb");
51    if(fp) {
52      curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)fp);
53      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
54
55      curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/foo.bin");
56
57      /* do not send TFTP options requests */
58      curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);
59
60      /* Perform the request */
61      curl_easy_perform(curl);
62
63      fclose(fp);
64    }
65    curl_easy_cleanup(curl);
66  }
67}
68~~~
69
70# AVAILABILITY
71
72Added in 7.48.0
73
74# RETURN VALUE
75
76Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
77