diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2015-08-24 00:15:01 -0400 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2016-02-23 03:01:07 -0500 |
commit | 186546f1c5ffa62526bd57deb5b9fd6e68da2a5e (patch) | |
tree | 064b4a45b134258416407201b82e53bd621c1f55 /docs/libcurl/opts | |
parent | 9dc3eaee2901875d87690de62b427fa7cf96fead (diff) |
TFTP: add option to suppress TFTP option requests (Part 2)
- Add tests.
- Add an example to CURLOPT_TFTP_NO_OPTIONS.3.
- Add --tftp-no-options to expose CURLOPT_TFTP_NO_OPTIONS.
Bug: https://github.com/curl/curl/issues/481
Diffstat (limited to 'docs/libcurl/opts')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 | 43 | ||||
-rw-r--r-- | docs/libcurl/opts/Makefile.am | 19 |
2 files changed, 46 insertions, 16 deletions
diff --git a/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 index 0e31a2937..53b1770be 100644 --- a/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 +++ b/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 @@ -20,24 +20,51 @@ .\" * .\" ************************************************************************** .\" -.TH CURLOPT_TFTP_NO_OPTIONS 3 "19 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options" +.TH CURLOPT_TFTP_NO_OPTIONS 3 "23 Feb 2016" "libcurl 7.48.0" "curl_easy_setopt options" .SH NAME -CURLOPT_TFTP_NO_OPTIONS \- Prevents TFTP options to be send with RRQs/WRQs +CURLOPT_TFTP_NO_OPTIONS \- Do not send TFTP options requests. .SH SYNOPSIS #include <curl/curl.h> -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long sendoptions); +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff); .SH DESCRIPTION -Set \fIsendoptions\fP to 1 to exclude all TFTP options defined in RFC2347, -RFC2348, RFC2349 from read and write requests. -libcurl will behave like a client implementing only RFC1350, ignoring any -protocol extensions. +Set \fIonoff\fP to 1L to exclude all TFTP options defined in RFC2347, RFC2348 +and RFC2349 from read and write requests (RRQs/WRQs). + +This option improves interop with some legacy servers that do not acknowledge +or properly implement TFTP options. When this option is used +\fICURLOPT_TFTP_BLKSIZE(3)\fP is ignored. .SH DEFAULT 0 .SH PROTOCOLS TFTP .SH EXAMPLE -TODO +.nf +size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp) +{ + return fwrite(ptr, size, nmemb, (FILE *)fp); +} + +CURL *curl = curl_easy_init(); +if(curl) { + FILE *fp = fopen("foo.bin", "wb"); + if(fp) { + curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)fp); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); + + curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/foo.bin"); + + /* do not send TFTP options requests */ + curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L); + + /* Perform the request */ + curl_easy_perform(curl); + + fclose(fp); + } + curl_easy_cleanup(curl); +} +.fi .SH AVAILABILITY Added in 7.48.0 .SH RETURN VALUE diff --git a/docs/libcurl/opts/Makefile.am b/docs/libcurl/opts/Makefile.am index 5c35ef92a..04f8b4bbe 100644 --- a/docs/libcurl/opts/Makefile.am +++ b/docs/libcurl/opts/Makefile.am @@ -97,11 +97,12 @@ man_MANS = CURLOPT_ACCEPT_ENCODING.3 CURLOPT_ACCEPTTIMEOUT_MS.3 \ CURLOPT_SSL_VERIFYPEER.3 CURLOPT_SSL_VERIFYSTATUS.3 \ CURLOPT_SSLVERSION.3 CURLOPT_STDERR.3 CURLOPT_TCP_KEEPALIVE.3 \ CURLOPT_TCP_KEEPIDLE.3 CURLOPT_TCP_KEEPINTVL.3 CURLOPT_TCP_NODELAY.3 \ - CURLOPT_TELNETOPTIONS.3 CURLOPT_TFTP_BLKSIZE.3 CURLOPT_TIMECONDITION.3 \ - CURLOPT_TIMEOUT.3 CURLOPT_TIMEOUT_MS.3 CURLOPT_TIMEVALUE.3 \ - CURLOPT_TLSAUTH_PASSWORD.3 CURLOPT_TLSAUTH_TYPE.3 \ - CURLOPT_TLSAUTH_USERNAME.3 CURLOPT_TRANSFER_ENCODING.3 \ - CURLOPT_TRANSFERTEXT.3 CURLOPT_UNRESTRICTED_AUTH.3 CURLOPT_UPLOAD.3 \ + CURLOPT_TELNETOPTIONS.3 CURLOPT_TFTP_BLKSIZE.3 \ + CURLOPT_TFTP_NO_OPTIONS.3 CURLOPT_TIMECONDITION.3 CURLOPT_TIMEOUT.3 \ + CURLOPT_TIMEOUT_MS.3 CURLOPT_TIMEVALUE.3 CURLOPT_TLSAUTH_PASSWORD.3 \ + CURLOPT_TLSAUTH_TYPE.3 CURLOPT_TLSAUTH_USERNAME.3 \ + CURLOPT_TRANSFER_ENCODING.3 CURLOPT_TRANSFERTEXT.3 \ + CURLOPT_UNRESTRICTED_AUTH.3 CURLOPT_UPLOAD.3 \ CURLOPT_URL.3 CURLOPT_USERAGENT.3 CURLOPT_USERNAME.3 CURLOPT_USERPWD.3 \ CURLOPT_USE_SSL.3 CURLOPT_VERBOSE.3 CURLOPT_WILDCARDMATCH.3 \ CURLOPT_WRITEDATA.3 CURLOPT_WRITEFUNCTION.3 CURLOPT_XFERINFODATA.3 \ @@ -224,8 +225,9 @@ HTMLPAGES = CURLOPT_ACCEPT_ENCODING.html CURLOPT_ACCEPTTIMEOUT_MS.html \ CURLOPT_SSLVERSION.html CURLOPT_STDERR.html CURLOPT_TCP_KEEPALIVE.html \ CURLOPT_TCP_KEEPIDLE.html CURLOPT_TCP_KEEPINTVL.html \ CURLOPT_TCP_NODELAY.html CURLOPT_TELNETOPTIONS.html \ - CURLOPT_TFTP_BLKSIZE.html CURLOPT_TIMECONDITION.html \ - CURLOPT_TIMEOUT.html CURLOPT_TIMEOUT_MS.html CURLOPT_TIMEVALUE.html \ + CURLOPT_TFTP_BLKSIZE.html CURLOPT_TFTP_NO_OPTIONS.html \ + CURLOPT_TIMECONDITION.html CURLOPT_TIMEOUT.html \ + CURLOPT_TIMEOUT_MS.html CURLOPT_TIMEVALUE.html \ CURLOPT_TLSAUTH_PASSWORD.html CURLOPT_TLSAUTH_TYPE.html \ CURLOPT_TLSAUTH_USERNAME.html CURLOPT_TRANSFER_ENCODING.html \ CURLOPT_TRANSFERTEXT.html CURLOPT_UNRESTRICTED_AUTH.html \ @@ -354,7 +356,8 @@ PDFPAGES = CURLOPT_ACCEPT_ENCODING.pdf CURLOPT_ACCEPTTIMEOUT_MS.pdf \ CURLOPT_SSLVERSION.pdf CURLOPT_STDERR.pdf CURLOPT_TCP_KEEPALIVE.pdf \ CURLOPT_TCP_KEEPIDLE.pdf CURLOPT_TCP_KEEPINTVL.pdf \ CURLOPT_TCP_NODELAY.pdf CURLOPT_TELNETOPTIONS.pdf \ - CURLOPT_TFTP_BLKSIZE.pdf CURLOPT_TIMECONDITION.pdf CURLOPT_TIMEOUT.pdf \ + CURLOPT_TFTP_BLKSIZE.pdf CURLOPT_TFTP_NO_OPTIONS.pdf \ + CURLOPT_TIMECONDITION.pdf CURLOPT_TIMEOUT.pdf \ CURLOPT_TIMEOUT_MS.pdf CURLOPT_TIMEVALUE.pdf \ CURLOPT_TLSAUTH_PASSWORD.pdf CURLOPT_TLSAUTH_TYPE.pdf \ CURLOPT_TLSAUTH_USERNAME.pdf CURLOPT_TRANSFER_ENCODING.pdf \ |