.\" * $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
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 <agent string>"
(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
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 <name=data>"
(HTTP)
Pass the data to the HTTP server as a cookie. It is supposedly the
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 <list of 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:
.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 <seconds>"
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
\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 <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
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 <file>"
Write the protocol headers to the specified file.
(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 <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
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
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:
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 <command>"
(FTP) If authenticating with the USER and PASS commands fails, send this
command. When connecting to Tumbleweed's Secure Transport server over FTPS
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
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
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 <header>"
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 <md5>"
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
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 <name>"
Perform an operation using a specified interface. You can enter interface
name, IP address or host name. An example could look like:
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
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 <seconds>"
This option sets the time a connection needs to remain idle before sending
keepalive probes and the time between individual keepalive probes. It is
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>[-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
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
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 <bytes>"
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
\&'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.
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
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
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 <key>"
(SSH) Public key file name. Allows you to provide your public key in this
separate file.
.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 <num>"
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
.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 <host[:port]>"
Use the specified SOCKS4 proxy. If the port number is not specified, it is
assumed at port 1080. (Added in 7.15.2)
.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 <OPT=val>"
Pass options to the telnet protocol. Supported options are:
.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 <user:password>"
Specify user and password to use for server authentication. Overrides
\fI-n/--netrc\fP and \fI--netrc-optional\fP.
\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.
.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
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 <direct.h>
#define F_OK 0
#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 {
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 */
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;
};
/* 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;
/* move the last pointer */
config->url_last = node;
+
+ node->flags = config->default_node_flags;
}
return node;
}
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,
{"*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
{"*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},
{"$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},
{"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},
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;
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 */
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 */
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
break;
#endif
case 'q': /* --ftp-create-dirs */
- config->ftp_create_dirs ^= TRUE;
+ config->ftp_create_dirs = toggle;
break;
case 'r': /* --create-dirs */
case 't': /* --proxy-ntlm */
if(curlinfo->features & CURL_VERSION_NTLM)
- config->proxyntlm ^= TRUE;
+ config->proxyntlm = toggle;
else
return PARAM_LIBCURL_DOESNT_SUPPORT;
break;
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! */
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)
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))
case 'k': /* --proxy-negotiate */
if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE)
- config->proxynegotiate ^= TRUE;
+ config->proxynegotiate = toggle;
else
return PARAM_LIBCURL_DOESNT_SUPPORT;
break;
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);
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;
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))
}
break;
case '#': /* --progress-bar */
- config->progressmode ^= CURL_PROGRESS_BAR;
+ config->progressmode = toggle?CURL_PROGRESS_BAR:0;
break;
case '0':
/* HTTP version 1.0 */
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 */
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 */
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;
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
break;
case 'g': /* g disables URLglobbing */
- config->globoff ^= TRUE;
+ config->globoff = toggle;
break;
case 'G': /* HTTP GET */
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);
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))
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;
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;
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;
}
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
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 */
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: ");
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)
}
config->postfieldsize = -1;
config->showerror=TRUE;
- config->conf=CONF_DEFAULT;
config->use_httpget=FALSE;
config->create_dirs=FALSE;
config->lastrecvtime = cutil_tvnow();
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;
&& 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 : "<stdout>");
if (separator)
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);
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);
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,
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);
}
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);
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);
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
#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 :