Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_TFTP_NO_OPTIONS.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .\"
23 .TH CURLOPT_TFTP_NO_OPTIONS 3 "April 06, 2016" "libcurl 7.59.0" "curl_easy_setopt options"
24
25 .SH NAME
26 CURLOPT_TFTP_NO_OPTIONS \- Do not send TFTP options requests.
27 .SH SYNOPSIS
28 #include <curl/curl.h>
29
30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff);
31 .SH DESCRIPTION
32 Set \fIonoff\fP to 1L to exclude all TFTP options defined in RFC2347, RFC2348
33 and RFC2349 from read and write requests (RRQs/WRQs).
34
35 This option improves interop with some legacy servers that do not acknowledge
36 or properly implement TFTP options. When this option is used
37 \fICURLOPT_TFTP_BLKSIZE(3)\fP is ignored.
38 .SH DEFAULT
39 0
40 .SH PROTOCOLS
41 TFTP
42 .SH EXAMPLE
43 .nf
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 CURL *curl = curl_easy_init();
50 if(curl) {
51   FILE *fp = fopen("foo.bin", "wb");
52   if(fp) {
53     curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)fp);
54     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
55
56     curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/foo.bin");
57
58     /* do not send TFTP options requests */
59     curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);
60
61     /* Perform the request */
62     curl_easy_perform(curl);
63
64     fclose(fp);
65   }
66   curl_easy_cleanup(curl);
67 }
68 .fi
69 .SH AVAILABILITY
70 Added in 7.48.0
71 .SH RETURN VALUE
72 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.