CURLOPT_TFTP_NO_OPTIONS.md (1654B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_TFTP_NO_OPTIONS 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_TFTP_BLKSIZE (3) 9 Protocol: 10 - TFTP 11 Added-in: 7.48.0 12 --- 13 14 # NAME 15 16 CURLOPT_TFTP_NO_OPTIONS - send no TFTP options requests 17 18 # SYNOPSIS 19 20 ~~~c 21 #include <curl/curl.h> 22 23 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff); 24 ~~~ 25 26 # DESCRIPTION 27 28 Set *onoff* to 1L to exclude all TFTP options defined in RFC 2347, 29 RFC 2348 and RFC 2349 from read and write requests. 30 31 This option improves interoperability with legacy servers that do not 32 acknowledge or properly implement TFTP options. When this option is used 33 CURLOPT_TFTP_BLKSIZE(3) is ignored. 34 35 # DEFAULT 36 37 0 38 39 # %PROTOCOLS% 40 41 # EXAMPLE 42 43 ~~~c 44 size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp) 45 { 46 return fwrite(ptr, size, nmemb, (FILE *)fp); 47 } 48 49 int 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 77 curl_easy_setopt(3) returns a CURLcode indicating success or error. 78 79 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 80 libcurl-errors(3).