From 5abfdc0140df0977b02506d16796f616158bfe88 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 8 Jun 2008 20:53:49 +0000 Subject: - curl the tool now deals with its command line options somewhat differently! All boolean options (such as -O, -I, -v etc), both short and long versions, now always switch on/enable the option named. Using the same option multiple times thus make no difference. To switch off one of those options, you need to use the long version of the option and type --no-OPTION. Like to disable verbose mode you use --no-verbose! - Added --remote-name-all to curl, which if used changes the default for all given URLs to be dealt with as if -O is used. So if you want to disable that for a specific URL after --remote-name-all has been used, you muse use -o - or --no-remote-name. --- CHANGES | 13 ++ RELEASE-NOTES | 4 +- docs/curl.1 | 116 ++++-------------- src/main.c | 351 +++++++++++++++++++++++++++++++---------------------- tests/data/test256 | 2 +- tests/data/test38 | 2 +- tests/runtests.pl | 10 +- 7 files changed, 253 insertions(+), 245 deletions(-) diff --git a/CHANGES b/CHANGES index b6ec8ae4b..66af119f4 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,19 @@ Changelog +Daniel Stenberg (8 Jun 2008) +- curl the tool now deals with its command line options somewhat differently! + All boolean options (such as -O, -I, -v etc), both short and long versions, + now always switch on/enable the option named. Using the same option multiple + times thus make no difference. To switch off one of those options, you need + to use the long version of the option and type --no-OPTION. Like to disable + verbose mode you use --no-verbose! + +- Added --remote-name-all to curl, which if used changes the default for all + given URLs to be dealt with as if -O is used. So if you want to disable that + for a specific URL after --remote-name-all has been used, you muse use -o - + or --no-remote-name. + Daniel Stenberg (6 Jun 2008) - Axel Tillequin and Arnaud Ebalard added support for CURLOPT_ISSUERCERT, for OpenSSL, NSS and GnuTLS-built libcurls. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fc90d7611..62fafedb3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,7 +1,7 @@ Curl and libcurl 7.18.3 Public curl releases: 106 - Command line options: 126 + Command line options: 127 curl_easy_setopt() options: 152 Public functions in libcurl: 58 Public web site mirrors: 37 @@ -13,6 +13,8 @@ This release includes the following changes: o Added CURLINFO_PRIMARY_IP o Added CURLOPT_CRLFILE and CURLE_SSL_CRL_BADFILE o Added CURLOPT_ISSUERCERT and CURLE_SSL_ISSUER_ERROR + o curl's option parser for boolean options reworked + o Added --remote-name-all This release includes the following bugfixes: diff --git a/docs/curl.1 b/docs/curl.1 index 98bfc198c..5c0a5a084 100644 --- a/docs/curl.1 +++ b/docs/curl.1 @@ -21,7 +21,7 @@ .\" * $Id$ .\" ************************************************************************** .\" -.TH curl 1 "5 Jan 2008" "Curl 7.18.0" "Curl Manual" +.TH curl 1 "5 June 2008" "Curl 7.18.3" "Curl Manual" .SH NAME curl \- transfer a URL .SH SYNOPSIS @@ -99,11 +99,15 @@ any response data to the terminal. If you prefer a progress "bar" instead of the regular meter, \fI-#\fP is your friend. .SH OPTIONS +In general, all boolean options are enabled with --option and yet again +disabled with --\fBno-\fPoption. That is, you use the exact same option name +but prefix it with "no-". However, in this list we mostly only list and show +the --option version of them. (This concept with --no options was added in +7.18.3. Previously most options were toggled on/off on repeated use of the +same command line option.) .IP "-a/--append" (FTP) When used in an FTP upload, this will tell curl to append to the target file instead of overwriting it. If the file doesn't exist, it will be created. - -If this option is used twice, the second one will disable append mode again. .IP "-A/--user-agent " (HTTP) Specify the User-Agent string to send to the HTTP server. Some badly done CGIs fail if this field isn't set to "Mozilla/4.0". To encode blanks in @@ -124,9 +128,6 @@ Note that using --anyauth is not recommended if you do uploads from stdin, since it may require data to be sent twice and then the client must be able to rewind. If the need should arise when uploading from stdin, the upload operation will fail. - -If this option is used several times, the following occurrences make no -difference. .IP "-b/--cookie " (HTTP) Pass the data to the HTTP server as a cookie. It is supposedly the @@ -152,16 +153,11 @@ used. Enable ASCII transfer when using FTP or LDAP. For FTP, this can also be enforced by using an URL that ends with ";type=A". This option causes data sent to stdout to be in text mode for win32 systems. - -If this option is used twice, the second one will disable ASCII usage. .IP "--basic" (HTTP) Tells curl to use HTTP Basic authentication. This is the default and this option is usually pointless, unless you use it to override a previously set option that sets a different authentication method (such as \fI--ntlm\fP, \fI--digest\fP and \fI--negotiate\fP). - -If this option is used several times, the following occurrences make no -difference. .IP "--ciphers " (SSL) Specifies which ciphers to use in the connection. The list of ciphers must be using valid ciphers. Read up on SSL cipher list details on this URL: @@ -175,9 +171,7 @@ If this option is used several times, the last one will override the others. .IP "--compressed" (HTTP) Request a compressed response using one of the algorithms libcurl supports, and return the uncompressed document. If this option is used and -the server sends an unsupported encoding, Curl will report an error. - -If this option is used several times, each occurrence will toggle it on/off. +the server sends an unsupported encoding, curl will report an error. .IP "--connect-timeout " Maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once curl has connected this option is @@ -220,9 +214,6 @@ To create remote directories when using FTP or SFTP, try \fI--ftp-create-dirs\fP. .IP "--crlf" (FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390). - -If this option is used several times, the following occurrences make no -difference. .IP "-d/--data " (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and @@ -298,13 +289,15 @@ away. EPRT and LPRT are extensions to the original FTP protocol, may not work on all servers but enable more functionality in a better way than the traditional PORT command. -If this option is used several times, each occurrence will toggle this on/off. +Since curl 7.18.3, \fB--eprt\fP can be used to explicitly enable EPRT again +and \fB--no-eprt\fP is an alias for \fB--disable-eprt\fP. .IP "--disable-epsv" (FTP) Tell curl to disable the use of the EPSV command when doing passive FTP transfers. Curl will normally always first attempt to use EPSV before PASV, but with this option, it will not try using EPSV. -If this option is used several times, each occurrence will toggle this on/off. +Since curl 7.18.3, \fB--epsv\fP can be used to explicitly enable EPRT again +and \fB--no-epsv\fP is an alias for \fB--disable-epsv\fP. .IP "-D/--dump-header " Write the protocol headers to the specified file. @@ -334,8 +327,6 @@ run-time. (RISC OS ONLY) Sets a range of environment variables, using the names the -w option supports, to easier allow extraction of useful information after having run curl. - -If this option is used several times, each occurrence will toggle this on/off. .IP "--egd-file " (SSL) Specify the path name to the Entropy Gathering Daemon socket. The socket is used to seed the random engine for SSL connections. See also the @@ -400,8 +391,6 @@ will prevent curl from outputting that and return error 22. This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407). - -If this option is used twice, the second will again disable silent failure. .IP "--ftp-account [data]" (FTP) When an FTP server asks for "account data" after user name and password has been provided, this data is sent off using the ACCT command. (Added in @@ -413,8 +402,6 @@ If this option is used twice, the second will override the previous use. currently exist on the server, the standard behavior of curl is to fail. Using this option, curl will instead attempt to create missing directories. - -If this option is used twice, the second will again disable directory creation. .IP "--ftp-method [method]" (FTP) Control what method curl should use to reach a file on a FTP(S) server. The method argument should be one of the following alternatives: @@ -437,7 +424,8 @@ using this option can be used to override a previous --ftp-port option. (Added in 7.11.0) If this option is used several times, the following occurrences make no -difference. +difference. Undoing an enforced PASV really isn't doable but you must then +instead enforce the correct EPRT again. .IP "--ftp-alternative-to-user " (FTP) If authenticating with the USER and PASS commands fails, send this command. When connecting to Tumbleweed's Secure Transport server over FTPS @@ -450,28 +438,19 @@ will re-use the same IP address it already uses for the control connection. (Added in 7.14.2) This option has no effect if PORT, EPRT or EPSV is used instead of PASV. - -If this option is used twice, the second will again use the server's suggested -address. .IP "--ftp-ssl" (FTP) Try to use SSL/TLS for the FTP connection. Reverts to a non-secure connection if the server doesn't support SSL/TLS. See also \fI--ftp-ssl-control\fP and \fI--ftp-ssl-reqd\fP for different levels of encryption required. (Added in 7.11.0) - -If this option is used twice, the second will again disable this. .IP "--ftp-ssl-control" (FTP) Require SSL/TLS for the ftp login, clear for transfer. Allows secure authentication, but non-encrypted data transfers for efficiency. Fails the transfer if the server doesn't support SSL/TLS. (Added in 7.16.0) - -If this option is used twice, the second will again disable this. .IP "--ftp-ssl-reqd" (FTP) Require SSL/TLS for the FTP connection. Terminates the connection if the server doesn't support SSL/TLS. (Added in 7.15.5) - -If this option is used twice, the second will again disable this. .IP "--ftp-ssl-ccc" (FTP) Use CCC (Clear Command Channel) Shuts down the SSL/TLS layer after authenticating. The rest of the @@ -479,8 +458,6 @@ control channel communication will be unencrypted. This allows NAT routers to follow the FTP transaction. The default mode is passive. See --ftp-ssl-ccc-mode for other modes. (Added in 7.16.1) - -If this option is used twice, the second will again disable this. .IP "--ftp-ssl-ccc-mode [active/passive]" (FTP) Use CCC (Clear Command Channel) Sets the CCC mode. The passive mode will not initiate the shutdown, but @@ -545,7 +522,8 @@ If used in combination with -I, the POST data will instead be appended to the URL with a HEAD request. If this option is used several times, the following occurrences make no -difference. +difference. This is because undoing a GET doesn't make sense, but you should +then instead enforce the alternative method you prefer. .IP "-h/--help" Usage help. .IP "-H/--header
" @@ -566,7 +544,7 @@ for you. See also the \fI-A/--user-agent\fP and \fI-e/--referer\fP options. This option can be used multiple times to add/replace/remove multiple headers. -.IP "--hostpubmd5" +.IP "--hostpubmd5 " Pass a string containing 32 hexadecimal digits. The string should be the 128 bit MD5 checksum of the remote host's public key, curl will refuse the connection with the host unless the md5sums match. This option is only for SCP @@ -577,11 +555,8 @@ Ignore the Content-Length header. This is particularly useful for servers running Apache 1.x, which will report incorrect Content-Length for files larger than 2 gigabytes. .IP "-i/--include" -(HTTP) -Include the HTTP-header in the output. The HTTP-header includes things +(HTTP) Include the HTTP-header in the output. The HTTP-header includes things like server-name, date of the document, HTTP-version and more... - -If this option is used twice, the second will again disable header include. .IP "--interface " Perform an operation using a specified interface. You can enter interface name, IP address or host name. An example could look like: @@ -595,15 +570,11 @@ Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on a FTP or FILE file, curl displays the file size and last modification time only. - -If this option is used twice, the second will again disable header only. .IP "-j/--junk-session-cookies" (HTTP) When curl is told to read cookies from a given file, this option will make it discard all "session cookies". This will basically have the same effect as if a new session is started. Typical browsers always discard session cookies when they're closed down. - -If this option is used several times, each occurrence will toggle this on/off. .IP "-k/--insecure" (SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using @@ -612,8 +583,6 @@ considered "insecure" to fail unless \fI-k/--insecure\fP is used. See this online resource for further details: \fBhttp://curl.haxx.se/docs/sslcerts.html\fP - -If this option is used twice, the second time will again disable it. .IP "--keepalive-time " This option sets the time a connection needs to remain idle before sending keepalive probes and the time between individual keepalive probes. It is @@ -738,7 +707,6 @@ This option causes an FTP NLST command to be sent. Some FTP servers list only files in their response to NLST; they do not include subdirectories and symbolic links. -If this option is used twice, the second will again disable list only. .IP "--local-port [-num]" Set a preferred number or range of local port numbers to use for the connection(s). Note that port numbers by nature is a scarce resource that @@ -759,8 +727,6 @@ When curl follows a redirect and the request is not a plain GET (for example POST or PUT), it will do the following request with a GET if the HTTP response was 301, 302, or 303. If the response code was any other 3xx code, curl will re-send the following request using the same unmodified method. - -If this option is used twice, the second will again disable location following. .IP "--location-trusted" (HTTP/HTTPS) Like \fI-L/--location\fP, but will allow sending the name + password to all hosts that the site may redirect to. This may or may not @@ -768,7 +734,6 @@ introduce a security breach if the site redirects you do a site to which you'll send your authentication info (which is plaintext in the case of HTTP Basic authentication). -If this option is used twice, the second will again disable location following. .IP "--max-filesize " Specify the maximum size (in bytes) of a file to download. If the file requested is larger than this value, the transfer will not start and curl will @@ -802,8 +767,6 @@ to ftp to the machine host.domain.com with user name \&'myself' and password \&'secret' should look similar to: .B "machine host.domain.com login myself password secret" - -If this option is used twice, the second will again disable netrc usage. .IP "--netrc-optional" Very similar to \fI--netrc\fP, but this option makes the .netrc usage \fBoptional\fP and not mandatory as the \fI--netrc\fP does. @@ -833,12 +796,14 @@ will use a standard buffered output stream that will have the effect that it will output the data in chunks, not necessarily exactly when the data arrives. Using this option will disable that buffering. -If this option is used twice, the second will again switch on buffering. +Note that this is the negated option name documented. You can thus use +\fI--buffer\fP to enforce the buffering. .IP "--no-keepalive" Disables the use of keepalive messages on the TCP connection, as by default curl enables them. -If this option is used twice, the second will again enable keepalive. +Note that this is the negated option name documented. You can thus use +\fI--keepalive\fP to enforce keepalive. .IP "--no-sessionid" (SSL) Disable curl's use of SSL session-ID caching. By default all transfers are done using the cache. Note that while nothing ever should get hurt by @@ -846,8 +811,8 @@ attempting to reuse SSL session-IDs, there seem to be broken SSL implementations in the wild that may require you to disable this in order for you to succeed. (Added in 7.16.0) -If this option is used twice, the second will again switch on use of the -session cache. +Note that this is the negated option name documented. You can thus use +\fI--sessionid\fP to enforce session-ID caching. .IP "--ntlm" (HTTP) Enables NTLM authentication. The NTLM authentication method was designed by Microsoft and is used by IIS web servers. It is a proprietary @@ -903,41 +868,26 @@ a redirection. This option is meaningful only when using \fI-L/--location\fP Tells curl to pick a suitable authentication method when communicating with the given proxy. This might cause an extra request/response round-trip. (Added in 7.13.2) - -If this option is used twice, the second will again disable the proxy use-any -authentication. .IP "--proxy-basic" Tells curl to use HTTP Basic authentication when communicating with the given proxy. Use \fI--basic\fP for enabling HTTP Basic with a remote host. Basic is the default authentication method curl uses with proxies. - -If this option is used twice, the second will again disable proxy HTTP Basic -authentication. .IP "--proxy-digest" Tells curl to use HTTP Digest authentication when communicating with the given proxy. Use \fI--digest\fP for enabling HTTP Digest with a remote host. - -If this option is used twice, the second will again disable proxy HTTP Digest. .IP "--proxy-negotiate" Tells curl to use HTTP Negotiate authentication when communicating with the given proxy. Use \fI--negotiate\fP for enabling HTTP Negotiate -with a remote host. - -If this option is used twice, the second will again disable proxy HTTP -Negotiate. (Added in 7.17.1) +with a remote host. (Added in 7.17.1) .IP "--proxy-ntlm" Tells curl to use HTTP NTLM authentication when communicating with the given proxy. Use \fI--ntlm\fP for enabling NTLM with a remote host. - -If this option is used twice, the second will again disable proxy HTTP NTLM. .IP "-p/--proxytunnel" When an HTTP proxy is used (\fI-x/--proxy\fP), this option will cause non-HTTP protocols to attempt to tunnel through the proxy instead of merely using it to do HTTP-like operations. The tunnel approach is made with the HTTP proxy CONNECT request and requires that the proxy allows direct connect to the remote port number curl wants to tunnel through to. - -If this option is used twice, the second will again disable proxy tunnel. .IP "--pubkey " (SSH) Public key file name. Allows you to provide your public key in this separate file. @@ -1033,14 +983,10 @@ If this option is used several times, the last one will be used. .IP "--raw" When used, it disables all internal HTTP decoding of content or transfer encodings and instead makes them passed on unaltered, raw. (Added in 7.16.2) - -If this option is used several times, each occurrence toggles this on/off. .IP "-R/--remote-time" When used, this will make libcurl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp. - -If this option is used twice, the second time disables this again. .IP "--retry " If a transient error is returned when curl tries to perform a transfer, it will retry this number of times before giving up. Setting the number to 0 @@ -1075,12 +1021,8 @@ If this option is used multiple times, the last occurrence decide the amount. .IP "-s/--silent" Silent mode. Don't show progress meter or error messages. Makes Curl mute. - -If this option is used twice, the second will again disable silent mode. .IP "-S/--show-error" When used with -s it makes curl show error message if it fails. - -If this option is used twice, the second will again disable show error. .IP "--socks4 " Use the specified SOCKS4 proxy. If the port number is not specified, it is assumed at port 1080. (Added in 7.15.2) @@ -1127,8 +1069,6 @@ If this option is used several times, the last one will be used. .IP "--tcp-nodelay" Turn on the TCP_NODELAY option. See the \fIcurl_easy_setopt(3)\fP man page for details about this option. (Added in 7.11.2) - -If this option is used several times, each occurrence toggles this on/off. .IP "-t/--telnet-option " Pass options to the telnet protocol. Supported options are: @@ -1181,8 +1121,6 @@ If this option is used several times, the last one will be used. .IP "--trace-time" Prepends a time stamp to each trace or verbose line that curl displays. (Added in 7.14.0) - -If this option is used several times, each occurrence will toggle it on/off. .IP "-u/--user " Specify user and password to use for server authentication. Overrides \fI-n/--netrc\fP and \fI--netrc-optional\fP. @@ -1222,8 +1160,6 @@ If you think this option still doesn't give you enough details, consider using \fI--trace\fP or \fI--trace-ascii\fP instead. This option overrides previous uses of \fI--trace-ascii\fP or \fI--trace\fP. - -If this option is used twice, the second will do nothing extra. .IP "-V/--version" Displays information about curl and the libcurl version it uses. @@ -1447,8 +1383,6 @@ IPv6 addresses only. .IP "-#/--progress-bar" Make curl display progress information as a progress bar instead of the default statistics. - -If this option is used twice, the second will again disable the progress bar. .SH FILES .I ~/.curlrc .RS diff --git a/src/main.c b/src/main.c index 18b9297f2..92f5efa97 100644 --- a/src/main.c +++ b/src/main.c @@ -200,32 +200,6 @@ typedef enum { HTTPREQ_LAST } HttpReq; -/* Just a set of bits */ -#ifndef CONF_DEFAULT -#define CONF_DEFAULT 0 -#endif - -#define CONF_ISATTY (1<<0) /* output to tty! */ -#define CONF_AUTO_REFERER (1<<4) /* the automatic referer-system please! */ -#define CONF_HEADER (1<<8) /* throw the header out too */ -#define CONF_NOPROGRESS (1<<10) /* shut off the progress meter */ -#define CONF_NOBODY (1<<11) /* get meta-data (headers) about the file - without transferring the body, use HEAD to - get http document */ -#define CONF_FAILONERROR (1<<12) /* no output on http error codes >= 300 */ -#define CONF_DIRLISTONLY (1<<16) /* request nonverbose directory listing */ -#define CONF_FTPAPPEND (1<<20) /* Append instead of overwrite on upload! */ -#define CONF_NETRC (1<<22) /* read user+password from .netrc */ -#define CONF_FOLLOWLOCATION (1<<23) /* use Location: Luke! */ -#define CONF_GETTEXT (1<<24) /* use ASCII/text for transfer */ -#define CONF_MUTE (1<<28) /* force NOPROGRESS */ - -#define CONF_NETRC_OPT (1<<29) /* read user+password from either - * .netrc or URL*/ -#define CONF_UNRESTRICTED_AUTH (1<<30) -/* Send authentication (user+password) when following - * locations, even when hostname changed */ - #ifdef WIN32 #include #define F_OK 0 @@ -380,9 +354,10 @@ static int ftruncate64 (int fd, curl_off_t where) #endif typedef enum { - TRACE_BIN, /* tcpdump inspired look */ - TRACE_ASCII, /* like *BIN but without the hex output */ - TRACE_PLAIN /* -v/--verbose type */ + TRACE_NONE, /* no trace/verbose output at all! */ + TRACE_BIN, /* tcpdump inspired look */ + TRACE_ASCII, /* like *BIN but without the hex output */ + TRACE_PLAIN /* -v/--verbose type */ } trace; struct OutStruct { @@ -431,7 +406,22 @@ struct Configurable { char *proxyuserpwd; char *proxy; bool proxytunnel; - long conf; + bool ftp_append; /* APPE on ftp */ + bool mute; /* shutup */ + bool use_ascii; /* select ascii or text transfer */ + bool autoreferer; /* automatically set referer */ + bool failonerror; /* fail on (HTTP) errors */ + bool include_headers; /* send headers to data output */ + bool no_body; /* don't get the body */ + bool dirlistonly; /* only get the FTP dir list */ + bool followlocation; /* follow http redirects */ + bool unrestricted_auth; /* Continue to send authentication (user+password) + when following ocations, even when hostname + changed */ + bool netrc_opt; + bool netrc; + bool noprogress; + bool isatty; /* updated internally only if the output is a tty */ struct getout *url_list; /* point to the first node */ struct getout *url_last; /* point to the last/current node */ struct getout *url_get; /* point to the node to fill in URL */ @@ -521,6 +511,8 @@ struct Configurable { bool nokeepalive; /* for keepalive needs */ long alivetime; + int default_node_flags; /* default flags to seach for each 'node', which is + basically each given URL to transfer */ struct OutStruct *outs; }; @@ -529,7 +521,7 @@ struct Configurable { /* produce this text message to the user unless mute was selected */ static void warnf(struct Configurable *config, const char *fmt, ...) { - if(!(config->conf & CONF_MUTE)) { + if(!config->mute) { va_list ap; int len; char *ptr; @@ -863,6 +855,8 @@ static struct getout *new_getout(struct Configurable *config) /* move the last pointer */ config->url_last = node; + + node->flags = config->default_node_flags; } return node; } @@ -1562,6 +1556,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ bool longopt=FALSE; bool singleopt=FALSE; /* when true means '-o foo' used '-ofoo' */ ParameterError err; + bool toggle=TRUE; /* how to switch boolean options, on or off. Controlled + by using --OPTION or --no-OPTION */ /* single-letter, long-name, @@ -1576,6 +1572,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"*c", "connect-timeout", TRUE}, {"*d", "ciphers", TRUE}, {"*e", "disable-epsv", FALSE}, + {"*E", "epsv", FALSE}, /* made like this to make --no-epsv and --epsv to + work although --disable-epsv is the documented + option */ #ifdef USE_ENVIRONMENT {"*f", "environment", FALSE}, #endif @@ -1602,6 +1601,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"*x", "krb4" , TRUE}, /* this is the previous name */ {"*y", "max-filesize", TRUE}, {"*z", "disable-eprt", FALSE}, + {"*Z", "eprt", FALSE}, /* made like this to make --no-eprt and --eprt to + work although --disable-eprt is the documented + option */ {"$a", "ftp-ssl", FALSE}, {"$b", "ftp-pasv", FALSE}, {"$c", "socks5", TRUE}, @@ -1626,14 +1628,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"$T", "socks4a", TRUE}, {"$u", "ftp-alternative-to-user", TRUE}, {"$v", "ftp-ssl-reqd", FALSE}, - {"$w", "no-sessionid", FALSE}, + {"$w", "sessionid", FALSE}, /* listed as --no-sessionid in the help */ {"$x", "ftp-ssl-control", FALSE}, {"$y", "ftp-ssl-ccc", FALSE}, {"$j", "ftp-ssl-ccc-mode", TRUE}, {"$z", "libcurl", TRUE}, {"$#", "raw", FALSE}, {"$0", "post301", FALSE}, - {"$1", "no-keepalive", FALSE}, + {"$1", "keepalive", FALSE}, /* listed as --no-keepalive in the help */ {"$2", "socks5-hostname", TRUE}, {"$3", "keepalive-time", TRUE}, @@ -1684,9 +1686,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"M", "manual", FALSE}, {"n", "netrc", FALSE}, {"no", "netrc-optional", FALSE}, - {"N", "no-buffer", FALSE}, + {"N", "buffer", FALSE}, /* listed as --no-buffer in the help */ {"o", "output", TRUE}, - {"O", "remote-name", FALSE}, + {"O", "remote-name", FALSE}, + {"Oa", "remote-name-all", FALSE}, {"p", "proxytunnel", FALSE}, {"P", "ftpport", TRUE}, /* older version */ {"P", "ftp-port", TRUE}, @@ -1718,6 +1721,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ char *word=('-' == flag[0])?flag+2:flag; size_t fnam=strlen(word); int numhits=0; + + if(!strncmp(word, "no-", 3)) { + /* disable this option but ignore the "no-" part when looking for it */ + word += 3; + toggle = FALSE; + } + for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) { if(curlx_strnequal(aliases[j].lname, word, fnam)) { longopt = TRUE; @@ -1778,15 +1788,17 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ if(hit < 0) { return PARAM_OPTION_UNKNOWN; } - if(!longopt && aliases[hit].extraparam && parse[1]) { - nextarg=(char *)&parse[1]; /* this is the actual extra parameter */ - singleopt=TRUE; /* don't loop anymore after this */ - } - else if(!nextarg && aliases[hit].extraparam) { - return PARAM_REQUIRES_PARAMETER; + if(aliases[hit].extraparam) { + /* this option requires an extra parameter */ + if(!longopt && parse[1]) { + nextarg=(char *)&parse[1]; /* this is the actual extra parameter */ + singleopt=TRUE; /* don't loop anymore after this */ + } + else if(!nextarg) + return PARAM_REQUIRES_PARAMETER; + else + *usedarg = TRUE; /* mark it as used */ } - else if(nextarg && aliases[hit].extraparam) - *usedarg = TRUE; /* mark it as used */ switch(letter) { case '*': /* options without a short option */ @@ -1805,11 +1817,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ GetStr(&config->cipher_list, nextarg); break; case 'e': /* --disable-epsv */ - config->disable_epsv ^= TRUE; + config->disable_epsv = toggle; + break; + case 'E': /* --epsv */ + config->disable_epsv = !toggle; break; #ifdef USE_ENVIRONMENT case 'f': - config->writeenv ^= TRUE; + config->writeenv = toggle; break; #endif case 'g': /* --trace */ @@ -1863,33 +1878,49 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'j': /* --compressed */ - config->encoding ^= TRUE; + config->encoding = toggle; break; case 'k': /* --digest */ - config->authtype = CURLAUTH_DIGEST; + if(toggle) + config->authtype |= CURLAUTH_DIGEST; + else + config->authtype &= ~CURLAUTH_DIGEST; break; case 'l': /* --negotiate */ - if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE) - config->authtype = CURLAUTH_GSSNEGOTIATE; + if(toggle) { + if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE) + config->authtype |= CURLAUTH_GSSNEGOTIATE; + else + return PARAM_LIBCURL_DOESNT_SUPPORT; + } else - return PARAM_LIBCURL_DOESNT_SUPPORT; + config->authtype &= ~CURLAUTH_GSSNEGOTIATE; break; case 'm': /* --ntlm */ - if(curlinfo->features & CURL_VERSION_NTLM) - config->authtype = CURLAUTH_NTLM; + if(toggle) { + if(curlinfo->features & CURL_VERSION_NTLM) + config->authtype |= CURLAUTH_NTLM; + else + return PARAM_LIBCURL_DOESNT_SUPPORT; + } else - return PARAM_LIBCURL_DOESNT_SUPPORT; + config->authtype &= ~CURLAUTH_NTLM; break; case 'n': /* --basic for completeness */ - config->authtype = CURLAUTH_BASIC; + if(toggle) + config->authtype |= CURLAUTH_BASIC; + else + config->authtype &= ~CURLAUTH_BASIC; break; case 'o': /* --anyauth, let libcurl pick it */ - config->authtype = CURLAUTH_ANY; + if(toggle) + config->authtype = CURLAUTH_ANY; + /* --no-anyauth simply doesn't touch it */ break; #ifdef MSDOS @@ -1898,7 +1929,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; #endif case 'q': /* --ftp-create-dirs */ - config->ftp_create_dirs ^= TRUE; + config->ftp_create_dirs = toggle; break; case 'r': /* --create-dirs */ @@ -1913,7 +1944,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ case 't': /* --proxy-ntlm */ if(curlinfo->features & CURL_VERSION_NTLM) - config->proxyntlm ^= TRUE; + config->proxyntlm = toggle; else return PARAM_LIBCURL_DOESNT_SUPPORT; break; @@ -1953,7 +1984,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ return PARAM_BAD_NUMERIC; break; case 'z': /* --disable-eprt */ - config->disable_eprt ^= TRUE; + config->disable_eprt = toggle; + break; + case 'Z': /* --eprt */ + config->disable_eprt = !toggle; break; default: /* the URL! */ @@ -1986,7 +2020,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ case '$': /* more options without a short option */ switch(subletter) { case 'a': /* --ftp-ssl */ - config->ftp_ssl ^= TRUE; + config->ftp_ssl = toggle; break; case 'b': /* --ftp-pasv */ if(config->ftpport) @@ -2012,13 +2046,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ config->socksver = CURLPROXY_SOCKS5_HOSTNAME; break; case 'd': /* --tcp-nodelay option */ - config->tcp_nodelay ^= TRUE; + config->tcp_nodelay = toggle; break; case 'e': /* --proxy-digest */ - config->proxydigest ^= TRUE; + config->proxydigest = toggle; break; case 'f': /* --proxy-basic */ - config->proxybasic ^= TRUE; + config->proxybasic = toggle; break; case 'g': /* --retry */ if(str2num(&config->req_retry, nextarg)) @@ -2035,7 +2069,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ case 'k': /* --proxy-negotiate */ if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE) - config->proxynegotiate ^= TRUE; + config->proxynegotiate = toggle; else return PARAM_LIBCURL_DOESNT_SUPPORT; break; @@ -2043,16 +2077,16 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ GetStr(&config->ftp_account, nextarg); break; case 'n': /* --proxy-anyauth */ - config->proxyanyauth ^= TRUE; + config->proxyanyauth = toggle; break; case 'o': /* --trace-time */ - config->tracetime ^= TRUE; + config->tracetime = toggle; break; case 'p': /* --ignore-content-length */ - config->ignorecl ^= TRUE; + config->ignorecl = toggle; break; case 'q': /* --ftp-skip-pasv-ip */ - config->ftp_skip_ip ^= TRUE; + config->ftp_skip_ip = toggle; break; case 'r': /* --ftp-method (undocumented at this point) */ config->ftp_filemethod = ftpfilemethod(config, nextarg); @@ -2077,16 +2111,16 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ GetStr(&config->ftp_alternative_to_user, nextarg); break; case 'v': /* --ftp-ssl-reqd */ - config->ftp_ssl_reqd ^= TRUE; + config->ftp_ssl_reqd = toggle; break; case 'w': /* --no-sessionid */ - config->disable_sessionid ^= TRUE; + config->disable_sessionid = !toggle; break; case 'x': /* --ftp-ssl-control */ - config->ftp_ssl_control ^= TRUE; + config->ftp_ssl_control = toggle; break; case 'y': /* --ftp-ssl-ccc */ - config->ftp_ssl_ccc ^= TRUE; + config->ftp_ssl_ccc = toggle; if(!config->ftp_ssl_ccc_mode) config->ftp_ssl_ccc_mode = CURLFTPSSL_CCC_PASSIVE; break; @@ -2098,13 +2132,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ GetStr(&config->libcurl, nextarg); break; case '#': /* --raw */ - config->raw ^= TRUE; + config->raw = toggle; break; case '0': /* --post301 */ - config->post301 ^= TRUE; + config->post301 = toggle; break; case '1': /* --no-keepalive */ - config->nokeepalive ^= TRUE; + config->nokeepalive = !toggle; break; case '3': /* --keepalive-time */ if(str2num(&config->alivetime, nextarg)) @@ -2113,7 +2147,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ } break; case '#': /* --progress-bar */ - config->progressmode ^= CURL_PROGRESS_BAR; + config->progressmode = toggle?CURL_PROGRESS_BAR:0; break; case '0': /* HTTP version 1.0 */ @@ -2141,7 +2175,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'a': /* This makes the FTP sessions use APPE instead of STOR */ - config->conf ^= CONF_FTPAPPEND; + config->ftp_append = toggle; break; case 'A': /* This specifies the User-Agent name */ @@ -2161,7 +2195,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'B': /* use ASCII/text when transfering */ - config->conf ^= CONF_GETTEXT; + config->use_ascii = toggle; break; case 'c': /* get the file name to dump all cookies in */ @@ -2349,9 +2383,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ if(ptr) { /* Automatic referer requested, this may be combined with a set initial one */ - config->conf |= CONF_AUTO_REFERER; + config->autoreferer = TRUE; *ptr = 0; /* zero terminate here */ } + else + config->autoreferer = FALSE; GetStr(&config->referer, nextarg); } break; @@ -2423,7 +2459,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'f': /* fail hard on errors */ - config->conf ^= CONF_FAILONERROR; + config->failonerror = toggle; break; case 'F': /* "form data" simulation, this is a little advanced so lets do our best @@ -2439,7 +2475,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'g': /* g disables URLglobbing */ - config->globoff ^= TRUE; + config->globoff = toggle; break; case 'G': /* HTTP GET */ @@ -2447,8 +2483,12 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'h': /* h for help */ - help(); - return PARAM_HELP_REQUESTED; + if(toggle) { + help(); + return PARAM_HELP_REQUESTED; + } + /* we now actually support --no-help too! */ + break; case 'H': /* A custom header to append to a list */ err = add2list(&config->headers, nextarg); @@ -2456,23 +2496,24 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ return err; break; case 'i': - config->conf ^= CONF_HEADER; /* include the HTTP header as well */ + config->include_headers = toggle; /* include the headers as well in the + general output stream */ break; case 'j': - config->cookiesession ^= TRUE; + config->cookiesession = toggle; break; case 'I': /* - * CONF_BODY will imply CONF_HEADER later on + * no_body will imply include_headers later on */ - config->conf ^= CONF_NOBODY; + config->no_body = toggle; if(SetHTTPrequest(config, - (config->conf & CONF_NOBODY)?HTTPREQ_HEAD:HTTPREQ_GET, + (config->no_body)?HTTPREQ_HEAD:HTTPREQ_GET, &config->httpreq)) return PARAM_BAD_USE; break; case 'k': /* allow insecure SSL connects */ - config->insecure_ok ^= TRUE; + config->insecure_ok = toggle; break; case 'K': /* parse config file */ if(parseconfig(nextarg, config)) @@ -2480,15 +2521,15 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ nextarg); break; case 'l': - config->conf ^= CONF_DIRLISTONLY; /* only list the names of the FTP dir */ + config->dirlistonly = toggle; /* only list the names of the FTP dir */ break; case 'L': - config->conf ^= CONF_FOLLOWLOCATION; /* Follow Location: HTTP headers */ + config->followlocation = toggle; /* Follow Location: HTTP headers */ switch (subletter) { case 't': /* Continue to send authentication (user+password) when following * locations, even when hostname changed */ - config->conf ^= CONF_UNRESTRICTED_AUTH; + config->unrestricted_auth = toggle; break; } break; @@ -2498,33 +2539,41 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ return PARAM_BAD_NUMERIC; break; case 'M': /* M for manual, huge help */ + if(toggle) { /* --no-manual shows no manual... */ #ifdef USE_MANUAL - hugehelp(); - return PARAM_HELP_REQUESTED; + hugehelp(); + return PARAM_HELP_REQUESTED; #else - warnf(config, - "built-in manual was disabled at build-time!\n"); - return PARAM_OPTION_UNKNOWN; + warnf(config, + "built-in manual was disabled at build-time!\n"); + return PARAM_OPTION_UNKNOWN; #endif + } + break; case 'n': switch(subletter) { case 'o': /* CA info PEM file */ /* use .netrc or URL */ - config->conf ^= CONF_NETRC_OPT; + config->netrc_opt = toggle; break; default: /* pick info from .netrc, if this is used for http, curl will automatically enfore user+password with the request */ - config->conf ^= CONF_NETRC; + config->netrc = toggle; break; } break; case 'N': /* disable the output I/O buffering */ - config->nobuffer ^= 1; + config->nobuffer = !toggle; break; - case 'o': - case 'O': + case 'O': /* --remote-name */ + if(subletter == 'a') { /* --remote-name-all */ + config->default_node_flags = toggle?GETOUT_USEREMOTE:0; + break; + } + /* fall-through! */ + case 'o': /* --output */ /* output file */ { struct getout *url; @@ -2546,11 +2595,16 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ if(url) { /* fill in the outfile */ - if('o' == letter) + if('o' == letter) { GetStr(&url->outfile, nextarg); + url->flags &= ~GETOUT_USEREMOTE; /* switch off */ + } else { url->outfile=NULL; /* leave it */ - url->flags |= GETOUT_USEREMOTE; + if(toggle) + url->flags |= GETOUT_USEREMOTE; /* switch on */ + else + url->flags &= ~GETOUT_USEREMOTE; /* switch off */ } url->flags |= GETOUT_OUTFILE; } @@ -2566,7 +2620,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'p': /* proxy tunnel for non-http protocols */ - config->proxytunnel ^= TRUE; + config->proxytunnel = toggle; break; case 'q': /* if used first, already taken care of, we do it like @@ -2628,16 +2682,19 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'R': /* use remote file's time */ - config->remote_time ^= TRUE; + config->remote_time = toggle; break; case 's': /* don't show progress meter, don't show errors : */ - config->conf ^= (CONF_MUTE|CONF_NOPROGRESS); - config->showerror ^= TRUE; /* toggle off */ + if(toggle) + config->mute = config->noprogress = TRUE; + else + config->mute = config->noprogress = FALSE; + config->showerror = !toggle; /* toggle off */ break; case 'S': /* show errors */ - config->showerror ^= TRUE; /* toggle on if used with -s */ + config->showerror = toggle; /* toggle on if used with -s */ break; case 't': /* Telnet options */ @@ -2689,17 +2746,26 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ checkpasswd("proxy", &config->proxyuserpwd); break; case 'v': - /* the '%' thing here will cause the trace get sent to stderr */ - GetStr(&config->trace_dump, (char *)"%"); - if(config->tracetype && (config->tracetype != TRACE_PLAIN)) - warnf(config, - "-v/--verbose overrides an earlier trace/verbose option\n"); - config->tracetype = TRACE_PLAIN; + if(toggle) { + /* the '%' thing here will cause the trace get sent to stderr */ + GetStr(&config->trace_dump, (char *)"%"); + if(config->tracetype && (config->tracetype != TRACE_PLAIN)) + warnf(config, + "-v/--verbose overrides an earlier trace/verbose option\n"); + config->tracetype = TRACE_PLAIN; + } + else + /* verbose is disabled here */ + config->tracetype = TRACE_NONE; break; case 'V': { const char * const *proto; + if(!toggle) + /* --no-version yields no output! */ + break; + printf(CURL_ID "%s\n", curl_version()); if (curlinfo->protocols) { printf("Protocols: "); @@ -3442,7 +3508,7 @@ int my_trace(CURL *handle, curl_infotype type, to stderr or stdout, we don't display the alert about the data not being shown as the data _is_ shown then just not via this function */ - if(!(config->conf&CONF_ISATTY) || + if(!config->isatty || ((config->trace_stream != stderr) && (config->trace_stream != stdout))) { if(!newl) @@ -3871,7 +3937,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) } config->postfieldsize = -1; config->showerror=TRUE; - config->conf=CONF_DEFAULT; config->use_httpget=FALSE; config->create_dirs=FALSE; config->lastrecvtime = cutil_tvnow(); @@ -3997,7 +4062,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) free(config->postfields); config->postfields = NULL; if(SetHTTPrequest(config, - (config->conf&CONF_NOBODY?HTTPREQ_HEAD:HTTPREQ_GET), + (config->no_body?HTTPREQ_HEAD:HTTPREQ_GET), &config->httpreq)) { free(httpgetfields); return PARAM_BAD_USE; @@ -4328,9 +4393,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) && outs.stream && isatty(fileno(outs.stream))) /* we send the output to a tty, therefore we switch off the progress meter */ - config->conf |= CONF_NOPROGRESS|CONF_ISATTY; + config->noprogress = config->isatty = TRUE; - if (urlnum > 1 && !(config->conf&CONF_MUTE)) { + if (urlnum > 1 && !(config->mute)) { fprintf(config->errors, "\n[%d/%d]: %s --> %s\n", i+1, urlnum, url, outfile ? outfile : ""); if (separator) @@ -4379,7 +4444,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) if(!config->errors) config->errors = stderr; - if(!outfile && !(config->conf & CONF_GETTEXT)) { + if(!outfile && !config->use_ascii) { /* We get the output to stdout and we have not got the ASCII/text flag, then set stdout to be binary */ SET_BINMODE(stdout); @@ -4414,33 +4479,29 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) my_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize); my_setopt(curl, CURLOPT_URL, url); /* what to fetch */ my_setopt(curl, CURLOPT_PROXY, config->proxy); /* proxy to use */ - my_setopt(curl, CURLOPT_NOPROGRESS, config->conf&CONF_NOPROGRESS); - if(config->conf&CONF_NOBODY) { + my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress); + if(config->no_body) { my_setopt(curl, CURLOPT_NOBODY, 1); my_setopt(curl, CURLOPT_HEADER, 1); } else - my_setopt(curl, CURLOPT_HEADER, config->conf&CONF_HEADER); + my_setopt(curl, CURLOPT_HEADER, config->include_headers); - my_setopt(curl, CURLOPT_FAILONERROR, - config->conf&CONF_FAILONERROR); + my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror); my_setopt(curl, CURLOPT_UPLOAD, uploadfile?TRUE:FALSE); - my_setopt(curl, CURLOPT_DIRLISTONLY, - config->conf&CONF_DIRLISTONLY); - my_setopt(curl, CURLOPT_APPEND, config->conf&CONF_FTPAPPEND); + my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly); + my_setopt(curl, CURLOPT_APPEND, config->ftp_append); - if (config->conf&CONF_NETRC_OPT) + if (config->netrc_opt) my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); - else if (config->conf&CONF_NETRC) + else if (config->netrc) my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_REQUIRED); else my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_IGNORED); - my_setopt(curl, CURLOPT_FOLLOWLOCATION, - config->conf&CONF_FOLLOWLOCATION); - my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, - config->conf&CONF_UNRESTRICTED_AUTH); - my_setopt(curl, CURLOPT_TRANSFERTEXT, config->conf&CONF_GETTEXT); + my_setopt(curl, CURLOPT_FOLLOWLOCATION, config->followlocation); + my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, config->unrestricted_auth); + my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii); my_setopt(curl, CURLOPT_USERPWD, config->userpwd); my_setopt(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd); my_setopt(curl, CURLOPT_RANGE, config->range); @@ -4459,8 +4520,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) break; } my_setopt(curl, CURLOPT_REFERER, config->referer); - my_setopt(curl, CURLOPT_AUTOREFERER, - config->conf&CONF_AUTO_REFERER); + my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer); my_setopt(curl, CURLOPT_USERAGENT, config->useragent); my_setopt(curl, CURLOPT_FTPPORT, config->ftpport); my_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, @@ -4507,8 +4567,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1); } - if((config->conf&CONF_NOBODY) || - config->remote_time) { + if(config->no_body || config->remote_time) { /* no body or use remote time */ my_setopt(curl, CURLOPT_FILETIME, TRUE); } @@ -4540,7 +4599,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) progressbarinit(&progressbar, config); if((config->progressmode == CURL_PROGRESS_BAR) && - !(config->conf&(CONF_NOPROGRESS|CONF_MUTE))) { + !config->noprogress && !config->mute) { /* we want the alternative style, then we have to implement it ourselves! */ my_setopt(curl, CURLOPT_PROGRESSFUNCTION, myprogress); @@ -4575,8 +4634,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) if(config->authtype) my_setopt(curl, CURLOPT_HTTPAUTH, config->authtype); - /* new in curl 7.9.7 */ - if(config->trace_dump) { + if(config->tracetype != TRACE_NONE) { my_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); my_setopt(curl, CURLOPT_DEBUGDATA, config); my_setopt(curl, CURLOPT_VERBOSE, TRUE); @@ -4776,8 +4834,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) if(outs.bytes && outs.filename) { /* We have written data to a output file, we truncate file */ - if(!(config->conf&CONF_MUTE)) - fprintf(config->errors, "Throwing away %Od bytes\n", outs.bytes); + if(!config->mute) + fprintf(config->errors, "Throwing away %Od bytes\n", + outs.bytes); fflush(outs.stream); /* truncate file at the position where we started appending */ #ifdef HAVE_FTRUNCATE @@ -5062,13 +5121,13 @@ static void show_dir_errno(FILE *errors, const char *name) #ifdef ENOSPC case ENOSPC: fprintf(errors,"No space left on the file system that will " - "contain the directory %s.\n", name); + "contain the directory %s.\n", name); break; #endif #ifdef EDQUOT case EDQUOT: fprintf(errors,"Cannot create directory %s because you " - "exceeded your quota.\n", name); + "exceeded your quota.\n", name); break; #endif default : diff --git a/tests/data/test256 b/tests/data/test256 index 07364ecca..fb28485c1 100644 --- a/tests/data/test256 +++ b/tests/data/test256 @@ -29,7 +29,7 @@ http HTTP resume request over proxy with auth without server supporting it --x http://%HOSTIP:%HTTPPORT http://%HOSTIP:%HTTPPORT/want/256 -C - -i -o log/fewl.txt -U daniel:stenberg +-x http://%HOSTIP:%HTTPPORT http://%HOSTIP:%HTTPPORT/want/256 -C - --no-include -o log/fewl.txt -U daniel:stenberg This text is here to simulate a partly downloaded file to resume diff --git a/tests/data/test38 b/tests/data/test38 index c188c6d34..377b5b2ae 100644 --- a/tests/data/test38 +++ b/tests/data/test38 @@ -28,7 +28,7 @@ http HTTP resume request without server supporting it -http://%HOSTIP:%HTTPPORT/want/38 -C - -i -o log/fewl.txt +http://%HOSTIP:%HTTPPORT/want/38 -C - --no-include -o log/fewl.txt This text is here to simulate a partly downloaded file to resume diff --git a/tests/runtests.pl b/tests/runtests.pl index 664098971..37172f27c 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -583,7 +583,7 @@ sub stopserver { sub verifyhttp { my ($proto, $ip, $port) = @_; - my $cmd = "$CURL -m$server_response_maxtime -o log/verifiedserver -ksvg \"$proto://$ip:$port/verifiedserver\" 2>log/verifyhttp"; + my $cmd = "$CURL --max-time $server_response_maxtime --output log/verifiedserver --insecure --silent --verbose --globoff \"$proto://$ip:$port/verifiedserver\" 2>log/verifyhttp"; my $pid; # verify if our/any server is running on this port @@ -636,9 +636,9 @@ sub verifyftp { my $time=time(); my $extra; if($proto eq "ftps") { - $extra = "-k --ftp-ssl-control "; + $extra = "--insecure --ftp-ssl-control "; } - my $cmd="$CURL -m$server_response_maxtime --silent -vg $extra\"$proto://$ip:$port/verifiedserver\" 2>log/verifyftp"; + my $cmd="$CURL --max-time $server_response_maxtime --silent --verbose --globoff $extra\"$proto://$ip:$port/verifiedserver\" 2>log/verifyftp"; # check if this is our server running on this port: my @data=runclientoutput($cmd); logmsg "RUN: $cmd\n" if($verbose); @@ -2008,8 +2008,8 @@ sub singletest { my $cmdargs; if(!$tool) { - # run curl, add -v for debug information output - $cmdargs ="$out --include -v --trace-time $cmd"; + # run curl, add --verbose for debug information output + $cmdargs ="$out --include --verbose --trace-time $cmd"; } else { $cmdargs = " $cmd"; # $cmd is the command line for the test file -- cgit v1.2.3