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