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
This commit is contained in:
Jay Satiro 2015-08-24 00:15:01 -04:00
parent 9dc3eaee29
commit 186546f1c5
12 changed files with 155 additions and 20 deletions

View file

@ -183,6 +183,7 @@ struct OperationConfig {
char *ftp_alternative_to_user; /* send command if USER/PASS fails */
int ftp_filemethod;
long tftp_blksize; /* TFTP BLKSIZE option */
bool tftp_no_options; /* do not send TFTP options requests */
bool ignorecl; /* --ignore-content-length */
bool disable_sessionid;

View file

@ -180,6 +180,7 @@ static const struct LongShort aliases[]= {
{"$P", "service-name", TRUE},
{"$Q", "proto-default", TRUE},
{"$R", "expect100-timeout", TRUE},
{"$S", "tftp-no-options", FALSE},
{"0", "http1.0", FALSE},
{"01", "http1.1", FALSE},
{"02", "http2", FALSE},
@ -1005,6 +1006,9 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(err)
return err;
break;
case 'S': /* --tftp-no-options */
config->tftp_no_options = toggle;
break;
}
break;
case '#': /* --progress-bar */

View file

@ -221,7 +221,8 @@ static const char *const helptext[] = {
" --tcp-nodelay Use the TCP_NODELAY option",
" -t, --telnet-option OPT=VAL Set telnet option",
" --tftp-blksize VALUE Set TFTP BLKSIZE option (must be >512)",
" -z, --time-cond TIME Transfer based on a time condition",
" --tftp-no-options Do not send TFTP options requests",
" -z, --time-cond TIME Transfer based on a time condition",
" -1, --tlsv1 Use >= TLSv1 (SSL)",
" --tlsv1.0 Use TLSv1.0 (SSL)",
" --tlsv1.1 Use TLSv1.1 (SSL)",

View file

@ -1354,6 +1354,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_EXPECT_100_TIMEOUT_MS,
(long)(config->expect100timeout*1000));
/* new in 7.48.0 */
if(config->tftp_no_options)
my_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);
/* initialize retry vars for loop below */
retry_sleep_default = (config->retry_delay) ?
config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */