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