| 1 |
/*************************************************************************** |
| 2 |
* _ _ ____ _ |
| 3 |
* Project ___| | | | _ \| | |
| 4 |
* / __| | | | |_) | | |
| 5 |
* | (__| |_| | _ <| |___ |
| 6 |
* \___|\___/|_| \_\_____| |
| 7 |
* |
| 8 |
* Copyright (C) 1998 - 2020, Daniel Stenberg, <[email protected]>, et al. |
| 9 |
* |
| 10 |
* This software is licensed as described in the file COPYING, which |
| 11 |
* you should have received as part of this distribution. The terms |
| 12 |
* are also available at https://curl.haxx.se/docs/copyright.html. |
| 13 |
* |
| 14 |
* You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 |
* copies of the Software, and permit persons to whom the Software is |
| 16 |
* furnished to do so, under the terms of the COPYING file. |
| 17 |
* |
| 18 |
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 |
* KIND, either express or implied. |
| 20 |
* |
| 21 |
***************************************************************************/ |
| 22 |
#include "tool_setup.h" |
| 23 |
#if defined(HAVE_STRCASECMP) && defined(HAVE_STRINGS_H) |
| 24 |
#include <strings.h> |
| 25 |
#endif |
| 26 |
|
| 27 |
#include "tool_panykey.h" |
| 28 |
#include "tool_help.h" |
| 29 |
#include "tool_libinfo.h" |
| 30 |
#include "tool_version.h" |
| 31 |
|
| 32 |
#include "memdebug.h" /* keep this as LAST include */ |
| 33 |
|
| 34 |
#ifdef MSDOS |
| 35 |
# define USE_WATT32 |
| 36 |
#endif |
| 37 |
|
| 38 |
/* |
| 39 |
* The help output is generated with the following command |
| 40 |
--------------------------------------------------------- |
| 41 |
|
| 42 |
cd $srcroot/docs/cmdline-opts |
| 43 |
./gen.pl listhelp |
| 44 |
*/ |
| 45 |
|
| 46 |
struct helptxt { |
| 47 |
const char *opt; |
| 48 |
const char *desc; |
| 49 |
}; |
| 50 |
|
| 51 |
static const struct helptxt helptext[] = { |
| 52 |
{" --abstract-unix-socket <path>", |
| 53 |
"Connect via abstract Unix domain socket"}, |
| 54 |
{" --alt-svc <file name>", |
| 55 |
"Enable alt-svc with this cache file"}, |
| 56 |
{" --anyauth", |
| 57 |
"Pick any authentication method"}, |
| 58 |
{"-a, --append", |
| 59 |
"Append to target file when uploading"}, |
| 60 |
{" --basic", |
| 61 |
"Use HTTP Basic Authentication"}, |
| 62 |
{" --cacert <file>", |
| 63 |
"CA certificate to verify peer against"}, |
| 64 |
{" --capath <dir>", |
| 65 |
"CA directory to verify peer against"}, |
| 66 |
{"-E, --cert <certificate[:password]>", |
| 67 |
"Client certificate file and password"}, |
| 68 |
{" --cert-status", |
| 69 |
"Verify the status of the server certificate"}, |
| 70 |
{" --cert-type <type>", |
| 71 |
"Certificate file type (DER/PEM/ENG)"}, |
| 72 |
{" --ciphers <list of ciphers>", |
| 73 |
"SSL ciphers to use"}, |
| 74 |
{" --compressed", |
| 75 |
"Request compressed response"}, |
| 76 |
{" --compressed-ssh", |
| 77 |
"Enable SSH compression"}, |
| 78 |
{"-K, --config <file>", |
| 79 |
"Read config from a file"}, |
| 80 |
{" --connect-timeout <seconds>", |
| 81 |
"Maximum time allowed for connection"}, |
| 82 |
{" --connect-to <HOST1:PORT1:HOST2:PORT2>", |
| 83 |
"Connect to host"}, |
| 84 |
{"-C, --continue-at <offset>", |
| 85 |
"Resumed transfer offset"}, |
| 86 |
{"-b, --cookie <data|filename>", |
| 87 |
"Send cookies from string/file"}, |
| 88 |
{"-c, --cookie-jar <filename>", |
| 89 |
"Write cookies to <filename> after operation"}, |
| 90 |
{" --create-dirs", |
| 91 |
"Create necessary local directory hierarchy"}, |
| 92 |
{" --crlf", |
| 93 |
"Convert LF to CRLF in upload"}, |
| 94 |
{" --crlfile <file>", |
| 95 |
"Get a CRL list in PEM format from the given file"}, |
| 96 |
{"-d, --data <data>", |
| 97 |
"HTTP POST data"}, |
| 98 |
{" --data-ascii <data>", |
| 99 |
"HTTP POST ASCII data"}, |
| 100 |
{" --data-binary <data>", |
| 101 |
"HTTP POST binary data"}, |
| 102 |
{" --data-raw <data>", |
| 103 |
"HTTP POST data, '@' allowed"}, |
| 104 |
{" --data-urlencode <data>", |
| 105 |
"HTTP POST data url encoded"}, |
| 106 |
{" --delegation <LEVEL>", |
| 107 |
"GSS-API delegation permission"}, |
| 108 |
{" --digest", |
| 109 |
"Use HTTP Digest Authentication"}, |
| 110 |
{"-q, --disable", |
| 111 |
"Disable .curlrc"}, |
| 112 |
{" --disable-eprt", |
| 113 |
"Inhibit using EPRT or LPRT"}, |
| 114 |
{" --disable-epsv", |
| 115 |
"Inhibit using EPSV"}, |
| 116 |
{" --disallow-username-in-url", |
| 117 |
"Disallow username in url"}, |
| 118 |
{" --dns-interface <interface>", |
| 119 |
"Interface to use for DNS requests"}, |
| 120 |
{" --dns-ipv4-addr <address>", |
| 121 |
"IPv4 address to use for DNS requests"}, |
| 122 |
{" --dns-ipv6-addr <address>", |
| 123 |
"IPv6 address to use for DNS requests"}, |
| 124 |
{" --dns-servers <addresses>", |
| 125 |
"DNS server addrs to use"}, |
| 126 |
{" --doh-url <URL>", |
| 127 |
"Resolve host names over DOH"}, |
| 128 |
{"-D, --dump-header <filename>", |
| 129 |
"Write the received headers to <filename>"}, |
| 130 |
{" --egd-file <file>", |
| 131 |
"EGD socket path for random data"}, |
| 132 |
{" --engine <name>", |
| 133 |
"Crypto engine to use"}, |
| 134 |
{" --etag-save <file>", |
| 135 |
"Get an ETag from response header and save it to a FILE"}, |
| 136 |
{" --etag-compare <file>", |
| 137 |
"Get an ETag from a file and send a conditional request"}, |
| 138 |
{" --expect100-timeout <seconds>", |
| 139 |
"How long to wait for 100-continue"}, |
| 140 |
{"-f, --fail", |
| 141 |
"Fail silently (no output at all) on HTTP errors"}, |
| 142 |
{" --fail-early", |
| 143 |
"Fail on first transfer error, do not continue"}, |
| 144 |
{" --false-start", |
| 145 |
"Enable TLS False Start"}, |
| 146 |
{"-F, --form <name=content>", |
| 147 |
"Specify multipart MIME data"}, |
| 148 |
{" --form-string <name=string>", |
| 149 |
"Specify multipart MIME data"}, |
| 150 |
{" --ftp-account <data>", |
| 151 |
"Account data string"}, |
| 152 |
{" --ftp-alternative-to-user <command>", |
| 153 |
"String to replace USER [name]"}, |
| 154 |
{" --ftp-create-dirs", |
| 155 |
"Create the remote dirs if not present"}, |
| 156 |
{" --ftp-method <method>", |
| 157 |
"Control CWD usage"}, |
| 158 |
{" --ftp-pasv", |
| 159 |
"Use PASV/EPSV instead of PORT"}, |
| 160 |
{"-P, --ftp-port <address>", |
| 161 |
"Use PORT instead of PASV"}, |
| 162 |
{" --ftp-pret", |
| 163 |
"Send PRET before PASV"}, |
| 164 |
{" --ftp-skip-pasv-ip", |
| 165 |
"Skip the IP address for PASV"}, |
| 166 |
{" --ftp-ssl-ccc", |
| 167 |
"Send CCC after authenticating"}, |
| 168 |
{" --ftp-ssl-ccc-mode <active/passive>", |
| 169 |
"Set CCC mode"}, |
| 170 |
{" --ftp-ssl-control", |
| 171 |
"Require SSL/TLS for FTP login, clear for transfer"}, |
| 172 |
{"-G, --get", |
| 173 |
"Put the post data in the URL and use GET"}, |
| 174 |
{"-g, --globoff", |
| 175 |
"Disable URL sequences and ranges using {} and []"}, |
| 176 |
{" --happy-eyeballs-timeout-ms <milliseconds>", |
| 177 |
"How long to wait in milliseconds for IPv6 before trying IPv4"}, |
| 178 |
{" --haproxy-protocol", |
| 179 |
"Send HAProxy PROXY protocol v1 header"}, |
| 180 |
{"-I, --head", |
| 181 |
"Show document info only"}, |
| 182 |
{"-H, --header <header/@file>", |
| 183 |
"Pass custom header(s) to server"}, |
| 184 |
{"-h, --help", |
| 185 |
"This help text"}, |
| 186 |
{" --hostpubmd5 <md5>", |
| 187 |
"Acceptable MD5 hash of the host public key"}, |
| 188 |
{" --http0.9", |
| 189 |
"Allow HTTP 0.9 responses"}, |
| 190 |
{"-0, --http1.0", |
| 191 |
"Use HTTP 1.0"}, |
| 192 |
{" --http1.1", |
| 193 |
"Use HTTP 1.1"}, |
| 194 |
{" --http2", |
| 195 |
"Use HTTP 2"}, |
| 196 |
{" --http2-prior-knowledge", |
| 197 |
"Use HTTP 2 without HTTP/1.1 Upgrade"}, |
| 198 |
{" --http3", |
| 199 |
"Use HTTP v3"}, |
| 200 |
{" --ignore-content-length", |
| 201 |
"Ignore the size of the remote resource"}, |
| 202 |
{"-i, --include", |
| 203 |
"Include protocol response headers in the output"}, |
| 204 |
{"-k, --insecure", |
| 205 |
"Allow insecure server connections when using SSL"}, |
| 206 |
{" --interface <name>", |
| 207 |
"Use network INTERFACE (or address)"}, |
| 208 |
{"-4, --ipv4", |
| 209 |
"Resolve names to IPv4 addresses"}, |
| 210 |
{"-6, --ipv6", |
| 211 |
"Resolve names to IPv6 addresses"}, |
| 212 |
{"-j, --junk-session-cookies", |
| 213 |
"Ignore session cookies read from file"}, |
| 214 |
{" --keepalive-time <seconds>", |
| 215 |
"Interval time for keepalive probes"}, |
| 216 |
{" --key <key>", |
| 217 |
"Private key file name"}, |
| 218 |
{" --key-type <type>", |
| 219 |
"Private key file type (DER/PEM/ENG)"}, |
| 220 |
{" --krb <level>", |
| 221 |
"Enable Kerberos with security <level>"}, |
| 222 |
{" --libcurl <file>", |
| 223 |
"Dump libcurl equivalent code of this command line"}, |
| 224 |
{" --limit-rate <speed>", |
| 225 |
"Limit transfer speed to RATE"}, |
| 226 |
{"-l, --list-only", |
| 227 |
"List only mode"}, |
| 228 |
{" --local-port <num/range>", |
| 229 |
"Force use of RANGE for local port numbers"}, |
| 230 |
{"-L, --location", |
| 231 |
"Follow redirects"}, |
| 232 |
{" --location-trusted", |
| 233 |
"Like --location, and send auth to other hosts"}, |
| 234 |
{" --login-options <options>", |
| 235 |
"Server login options"}, |
| 236 |
{" --mail-auth <address>", |
| 237 |
"Originator address of the original email"}, |
| 238 |
{" --mail-from <address>", |
| 239 |
"Mail from this address"}, |
| 240 |
{" --mail-rcpt <address>", |
| 241 |
"Mail to this address"}, |
| 242 |
{" --mail-rcpt-allowfails", |
| 243 |
"Allow RCPT TO command to fail for some recipients"}, |
| 244 |
{"-M, --manual", |
| 245 |
"Display the full manual"}, |
| 246 |
{" --max-filesize <bytes>", |
| 247 |
"Maximum file size to download"}, |
| 248 |
{" --max-redirs <num>", |
| 249 |
"Maximum number of redirects allowed"}, |
| 250 |
{"-m, --max-time <seconds>", |
| 251 |
"Maximum time allowed for the transfer"}, |
| 252 |
{" --metalink", |
| 253 |
"Process given URLs as metalink XML file"}, |
| 254 |
{" --negotiate", |
| 255 |
"Use HTTP Negotiate (SPNEGO) authentication"}, |
| 256 |
{"-n, --netrc", |
| 257 |
"Must read .netrc for user name and password"}, |
| 258 |
{" --netrc-file <filename>", |
| 259 |
"Specify FILE for netrc"}, |
| 260 |
{" --netrc-optional", |
| 261 |
"Use either .netrc or URL"}, |
| 262 |
{"-:, --next", |
| 263 |
"Make next URL use its separate set of options"}, |
| 264 |
{" --no-alpn", |
| 265 |
"Disable the ALPN TLS extension"}, |
| 266 |
{"-N, --no-buffer", |
| 267 |
"Disable buffering of the output stream"}, |
| 268 |
{" --no-keepalive", |
| 269 |
"Disable TCP keepalive on the connection"}, |
| 270 |
{" --no-npn", |
| 271 |
"Disable the NPN TLS extension"}, |
| 272 |
{" --no-progress-meter", |
| 273 |
"Do not show the progress meter"}, |
| 274 |
{" --no-sessionid", |
| 275 |
"Disable SSL session-ID reusing"}, |
| 276 |
{" --noproxy <no-proxy-list>", |
| 277 |
"List of hosts which do not use proxy"}, |
| 278 |
{" --ntlm", |
| 279 |
"Use HTTP NTLM authentication"}, |
| 280 |
{" --ntlm-wb", |
| 281 |
"Use HTTP NTLM authentication with winbind"}, |
| 282 |
{" --oauth2-bearer <token>", |
| 283 |
"OAuth 2 Bearer Token"}, |
| 284 |
{"-o, --output <file>", |
| 285 |
"Write to file instead of stdout"}, |
| 286 |
{"-Z, --parallel", |
| 287 |
"Perform transfers in parallel"}, |
| 288 |
{" --parallel-immediate", |
| 289 |
"Do not wait for multiplexing (with --parallel)"}, |
| 290 |
{" --parallel-max", |
| 291 |
"Maximum concurrency for parallel transfers"}, |
| 292 |
{" --pass <phrase>", |
| 293 |
"Pass phrase for the private key"}, |
| 294 |
{" --path-as-is", |
| 295 |
"Do not squash .. sequences in URL path"}, |
| 296 |
{" --pinnedpubkey <hashes>", |
| 297 |
"FILE/HASHES Public key to verify peer against"}, |
| 298 |
{" --post301", |
| 299 |
"Do not switch to GET after following a 301"}, |
| 300 |
{" --post302", |
| 301 |
"Do not switch to GET after following a 302"}, |
| 302 |
{" --post303", |
| 303 |
"Do not switch to GET after following a 303"}, |
| 304 |
{" --preproxy [protocol://]host[:port]", |
| 305 |
"Use this proxy first"}, |
| 306 |
{"-#, --progress-bar", |
| 307 |
"Display transfer progress as a bar"}, |
| 308 |
{" --proto <protocols>", |
| 309 |
"Enable/disable PROTOCOLS"}, |
| 310 |
{" --proto-default <protocol>", |
| 311 |
"Use PROTOCOL for any URL missing a scheme"}, |
| 312 |
{" --proto-redir <protocols>", |
| 313 |
"Enable/disable PROTOCOLS on redirect"}, |
| 314 |
{"-x, --proxy [protocol://]host[:port]", |
| 315 |
"Use this proxy"}, |
| 316 |
{" --proxy-anyauth", |
| 317 |
"Pick any proxy authentication method"}, |
| 318 |
{" --proxy-basic", |
| 319 |
"Use Basic authentication on the proxy"}, |
| 320 |
{" --proxy-cacert <file>", |
| 321 |
"CA certificate to verify peer against for proxy"}, |
| 322 |
{" --proxy-capath <dir>", |
| 323 |
"CA directory to verify peer against for proxy"}, |
| 324 |
{" --proxy-cert <cert[:passwd]>", |
| 325 |
"Set client certificate for proxy"}, |
| 326 |
{" --proxy-cert-type <type>", |
| 327 |
"Client certificate type for HTTPS proxy"}, |
| 328 |
{" --proxy-ciphers <list>", |
| 329 |
"SSL ciphers to use for proxy"}, |
| 330 |
{" --proxy-crlfile <file>", |
| 331 |
"Set a CRL list for proxy"}, |
| 332 |
{" --proxy-digest", |
| 333 |
"Use Digest authentication on the proxy"}, |
| 334 |
{" --proxy-header <header/@file>", |
| 335 |
"Pass custom header(s) to proxy"}, |
| 336 |
{" --proxy-insecure", |
| 337 |
"Do HTTPS proxy connections without verifying the proxy"}, |
| 338 |
{" --proxy-key <key>", |
| 339 |
"Private key for HTTPS proxy"}, |
| 340 |
{" --proxy-key-type <type>", |
| 341 |
"Private key file type for proxy"}, |
| 342 |
{" --proxy-negotiate", |
| 343 |
"Use HTTP Negotiate (SPNEGO) authentication on the proxy"}, |
| 344 |
{" --proxy-ntlm", |
| 345 |
"Use NTLM authentication on the proxy"}, |
| 346 |
{" --proxy-pass <phrase>", |
| 347 |
"Pass phrase for the private key for HTTPS proxy"}, |
| 348 |
{" --proxy-pinnedpubkey <hashes>", |
| 349 |
"FILE/HASHES public key to verify proxy with"}, |
| 350 |
{" --proxy-service-name <name>", |
| 351 |
"SPNEGO proxy service name"}, |
| 352 |
{" --proxy-ssl-allow-beast", |
| 353 |
"Allow security flaw for interop for HTTPS proxy"}, |
| 354 |
{" --proxy-tls13-ciphers <list>", |
| 355 |
"TLS 1.3 ciphersuites for proxy (OpenSSL)"}, |
| 356 |
{" --proxy-tlsauthtype <type>", |
| 357 |
"TLS authentication type for HTTPS proxy"}, |
| 358 |
{" --proxy-tlspassword <string>", |
| 359 |
"TLS password for HTTPS proxy"}, |
| 360 |
{" --proxy-tlsuser <name>", |
| 361 |
"TLS username for HTTPS proxy"}, |
| 362 |
{" --proxy-tlsv1", |
| 363 |
"Use TLSv1 for HTTPS proxy"}, |
| 364 |
{"-U, --proxy-user <user:password>", |
| 365 |
"Proxy user and password"}, |
| 366 |
{" --proxy1.0 <host[:port]>", |
| 367 |
"Use HTTP/1.0 proxy on given port"}, |
| 368 |
{"-p, --proxytunnel", |
| 369 |
"Operate through an HTTP proxy tunnel (using CONNECT)"}, |
| 370 |
{" --pubkey <key>", |
| 371 |
"SSH Public key file name"}, |
| 372 |
{"-Q, --quote", |
| 373 |
"Send command(s) to server before transfer"}, |
| 374 |
{" --random-file <file>", |
| 375 |
"File for reading random data from"}, |
| 376 |
{"-r, --range <range>", |
| 377 |
"Retrieve only the bytes within RANGE"}, |
| 378 |
{" --raw", |
| 379 |
"Do HTTP \"raw\"; no transfer decoding"}, |
| 380 |
{"-e, --referer <URL>", |
| 381 |
"Referrer URL"}, |
| 382 |
{"-J, --remote-header-name", |
| 383 |
"Use the header-provided filename"}, |
| 384 |
{"-O, --remote-name", |
| 385 |
"Write output to a file named as the remote file"}, |
| 386 |
{" --remote-name-all", |
| 387 |
"Use the remote file name for all URLs"}, |
| 388 |
{"-R, --remote-time", |
| 389 |
"Set the remote file's time on the local output"}, |
| 390 |
{"-X, --request <command>", |
| 391 |
"Specify request command to use"}, |
| 392 |
{" --request-target", |
| 393 |
"Specify the target for this request"}, |
| 394 |
{" --resolve <host:port:address[,address]...>", |
| 395 |
"Resolve the host+port to this address"}, |
| 396 |
{" --retry <num>", |
| 397 |
"Retry request if transient problems occur"}, |
| 398 |
{" --retry-connrefused", |
| 399 |
"Retry on connection refused (use with --retry)"}, |
| 400 |
{" --retry-delay <seconds>", |
| 401 |
"Wait time between retries"}, |
| 402 |
{" --retry-max-time <seconds>", |
| 403 |
"Retry only within this period"}, |
| 404 |
{" --sasl-authzid <identity> ", |
| 405 |
"Use this identity to act as during SASL PLAIN authentication"}, |
| 406 |
{" --sasl-ir", |
| 407 |
"Enable initial response in SASL authentication"}, |
| 408 |
{" --service-name <name>", |
| 409 |
"SPNEGO service name"}, |
| 410 |
{"-S, --show-error", |
| 411 |
"Show error even when -s is used"}, |
| 412 |
{"-s, --silent", |
| 413 |
"Silent mode"}, |
| 414 |
{" --socks4 <host[:port]>", |
| 415 |
"SOCKS4 proxy on given host + port"}, |
| 416 |
{" --socks4a <host[:port]>", |
| 417 |
"SOCKS4a proxy on given host + port"}, |
| 418 |
{" --socks5 <host[:port]>", |
| 419 |
"SOCKS5 proxy on given host + port"}, |
| 420 |
{" --socks5-basic", |
| 421 |
"Enable username/password auth for SOCKS5 proxies"}, |
| 422 |
{" --socks5-gssapi", |
| 423 |
"Enable GSS-API auth for SOCKS5 proxies"}, |
| 424 |
{" --socks5-gssapi-nec", |
| 425 |
"Compatibility with NEC SOCKS5 server"}, |
| 426 |
{" --socks5-gssapi-service <name>", |
| 427 |
"SOCKS5 proxy service name for GSS-API"}, |
| 428 |
{" --socks5-hostname <host[:port]>", |
| 429 |
"SOCKS5 proxy, pass host name to proxy"}, |
| 430 |
{"-Y, --speed-limit <speed>", |
| 431 |
"Stop transfers slower than this"}, |
| 432 |
{"-y, --speed-time <seconds>", |
| 433 |
"Trigger 'speed-limit' abort after this time"}, |
| 434 |
{" --ssl", |
| 435 |
"Try SSL/TLS"}, |
| 436 |
{" --ssl-allow-beast", |
| 437 |
"Allow security flaw to improve interop"}, |
| 438 |
{" --ssl-no-revoke", |
| 439 |
"Disable cert revocation checks (Schannel)"}, |
| 440 |
{" --ssl-reqd", |
| 441 |
"Require SSL/TLS"}, |
| 442 |
{"-2, --sslv2", |
| 443 |
"Use SSLv2"}, |
| 444 |
{"-3, --sslv3", |
| 445 |
"Use SSLv3"}, |
| 446 |
{" --stderr", |
| 447 |
"Where to redirect stderr"}, |
| 448 |
{" --styled-output", |
| 449 |
"Enable styled output for HTTP headers"}, |
| 450 |
{" --suppress-connect-headers", |
| 451 |
"Suppress proxy CONNECT response headers"}, |
| 452 |
{" --tcp-fastopen", |
| 453 |
"Use TCP Fast Open"}, |
| 454 |
{" --tcp-nodelay", |
| 455 |
"Use the TCP_NODELAY option"}, |
| 456 |
{"-t, --telnet-option <opt=val>", |
| 457 |
"Set telnet option"}, |
| 458 |
{" --tftp-blksize <value>", |
| 459 |
"Set TFTP BLKSIZE option"}, |
| 460 |
{" --tftp-no-options", |
| 461 |
"Do not send any TFTP options"}, |
| 462 |
{"-z, --time-cond <time>", |
| 463 |
"Transfer based on a time condition"}, |
| 464 |
{" --tls-max <VERSION>", |
| 465 |
"Set maximum allowed TLS version"}, |
| 466 |
{" --tls13-ciphers <list>", |
| 467 |
"TLS 1.3 ciphersuites (OpenSSL)"}, |
| 468 |
{" --tlsauthtype <type>", |
| 469 |
"TLS authentication type"}, |
| 470 |
{" --tlspassword", |
| 471 |
"TLS password"}, |
| 472 |
{" --tlsuser <name>", |
| 473 |
"TLS user name"}, |
| 474 |
{"-1, --tlsv1", |
| 475 |
"Use TLSv1.0 or greater"}, |
| 476 |
{" --tlsv1.0", |
| 477 |
"Use TLSv1.0 or greater"}, |
| 478 |
{" --tlsv1.1", |
| 479 |
"Use TLSv1.1 or greater"}, |
| 480 |
{" --tlsv1.2", |
| 481 |
"Use TLSv1.2 or greater"}, |
| 482 |
{" --tlsv1.3", |
| 483 |
"Use TLSv1.3 or greater"}, |
| 484 |
{" --tr-encoding", |
| 485 |
"Request compressed transfer encoding"}, |
| 486 |
{" --trace <file>", |
| 487 |
"Write a debug trace to FILE"}, |
| 488 |
{" --trace-ascii <file>", |
| 489 |
"Like --trace, but without hex output"}, |
| 490 |
{" --trace-time", |
| 491 |
"Add time stamps to trace/verbose output"}, |
| 492 |
{" --unix-socket <path>", |
| 493 |
"Connect through this Unix domain socket"}, |
| 494 |
{"-T, --upload-file <file>", |
| 495 |
"Transfer local FILE to destination"}, |
| 496 |
{" --url <url>", |
| 497 |
"URL to work with"}, |
| 498 |
{"-B, --use-ascii", |
| 499 |
"Use ASCII/text transfer"}, |
| 500 |
{"-u, --user <user:password>", |
| 501 |
"Server user and password"}, |
| 502 |
{"-A, --user-agent <name>", |
| 503 |
"Send User-Agent <name> to server"}, |
| 504 |
{"-v, --verbose", |
| 505 |
"Make the operation more talkative"}, |
| 506 |
{"-V, --version", |
| 507 |
"Show version number and quit"}, |
| 508 |
{"-w, --write-out <format>", |
| 509 |
"Use output FORMAT after completion"}, |
| 510 |
{" --xattr", |
| 511 |
"Store metadata in extended file attributes"}, |
| 512 |
{ NULL, NULL } |
| 513 |
}; |
| 514 |
|
| 515 |
#ifdef NETWARE |
| 516 |
# define PRINT_LINES_PAUSE 23 |
| 517 |
#endif |
| 518 |
|
| 519 |
#ifdef __SYMBIAN32__ |
| 520 |
# define PRINT_LINES_PAUSE 16 |
| 521 |
#endif |
| 522 |
|
| 523 |
struct feat { |
| 524 |
const char *name; |
| 525 |
int bitmask; |
| 526 |
}; |
| 527 |
|
| 528 |
static const struct feat feats[] = { |
| 529 |
{"AsynchDNS", CURL_VERSION_ASYNCHDNS}, |
| 530 |
{"Debug", CURL_VERSION_DEBUG}, |
| 531 |
{"TrackMemory", CURL_VERSION_CURLDEBUG}, |
| 532 |
{"IDN", CURL_VERSION_IDN}, |
| 533 |
{"IPv6", CURL_VERSION_IPV6}, |
| 534 |
{"Largefile", CURL_VERSION_LARGEFILE}, |
| 535 |
{"SSPI", CURL_VERSION_SSPI}, |
| 536 |
{"GSS-API", CURL_VERSION_GSSAPI}, |
| 537 |
{"Kerberos", CURL_VERSION_KERBEROS5}, |
| 538 |
{"SPNEGO", CURL_VERSION_SPNEGO}, |
| 539 |
{"NTLM", CURL_VERSION_NTLM}, |
| 540 |
{"NTLM_WB", CURL_VERSION_NTLM_WB}, |
| 541 |
{"SSL", CURL_VERSION_SSL}, |
| 542 |
{"libz", CURL_VERSION_LIBZ}, |
| 543 |
{"brotli", CURL_VERSION_BROTLI}, |
| 544 |
{"CharConv", CURL_VERSION_CONV}, |
| 545 |
{"TLS-SRP", CURL_VERSION_TLSAUTH_SRP}, |
| 546 |
{"HTTP2", CURL_VERSION_HTTP2}, |
| 547 |
{"HTTP3", CURL_VERSION_HTTP3}, |
| 548 |
{"UnixSockets", CURL_VERSION_UNIX_SOCKETS}, |
| 549 |
{"HTTPS-proxy", CURL_VERSION_HTTPS_PROXY}, |
| 550 |
{"MultiSSL", CURL_VERSION_MULTI_SSL}, |
| 551 |
{"PSL", CURL_VERSION_PSL}, |
| 552 |
{"alt-svc", CURL_VERSION_ALTSVC}, |
| 553 |
{"ESNI", CURL_VERSION_ESNI}, |
| 554 |
}; |
| 555 |
|
| 556 |
void tool_help(void) |
| 557 |
{ |
| 558 |
int i; |
| 559 |
puts("Usage: curl [options...] <url>"); |
| 560 |
for(i = 0; helptext[i].opt; i++) { |
| 561 |
printf(" %-19s %s\n", helptext[i].opt, helptext[i].desc); |
| 562 |
#ifdef PRINT_LINES_PAUSE |
| 563 |
if(i && ((i % PRINT_LINES_PAUSE) == 0)) |
| 564 |
tool_pressanykey(); |
| 565 |
#endif |
| 566 |
} |
| 567 |
} |
| 568 |
|
| 569 |
static int |
| 570 |
featcomp(const void *p1, const void *p2) |
| 571 |
{ |
| 572 |
/* The arguments to this function are "pointers to pointers to char", but |
| 573 |
the comparison arguments are "pointers to char", hence the following cast |
| 574 |
plus dereference */ |
| 575 |
#ifdef HAVE_STRCASECMP |
| 576 |
return strcasecmp(* (char * const *) p1, * (char * const *) p2); |
| 577 |
#elif defined(HAVE_STRCMPI) |
| 578 |
return strcmpi(* (char * const *) p1, * (char * const *) p2); |
| 579 |
#else |
| 580 |
return strcmp(* (char * const *) p1, * (char * const *) p2); |
| 581 |
#endif |
| 582 |
} |
| 583 |
|
| 584 |
void tool_version_info(void) |
| 585 |
{ |
| 586 |
const char *const *proto; |
| 587 |
|
| 588 |
printf(CURL_ID "%s\n", curl_version()); |
| 589 |
#ifdef CURL_PATCHSTAMP |
| 590 |
printf("Release-Date: %s, security patched: %s\n", |
| 591 |
LIBCURL_TIMESTAMP, CURL_PATCHSTAMP); |
| 592 |
#else |
| 593 |
printf("Release-Date: %s\n", LIBCURL_TIMESTAMP); |
| 594 |
#endif |
| 595 |
if(curlinfo->protocols) { |
| 596 |
printf("Protocols: "); |
| 597 |
for(proto = curlinfo->protocols; *proto; ++proto) { |
| 598 |
printf("%s ", *proto); |
| 599 |
} |
| 600 |
puts(""); /* newline */ |
| 601 |
} |
| 602 |
if(curlinfo->features) { |
| 603 |
char *featp[ sizeof(feats) / sizeof(feats[0]) + 1]; |
| 604 |
size_t numfeat = 0; |
| 605 |
unsigned int i; |
| 606 |
printf("Features:"); |
| 607 |
for(i = 0; i < sizeof(feats)/sizeof(feats[0]); i++) { |
| 608 |
if(curlinfo->features & feats[i].bitmask) |
| 609 |
featp[numfeat++] = (char *)feats[i].name; |
| 610 |
} |
| 611 |
#ifdef USE_METALINK |
| 612 |
featp[numfeat++] = (char *)"Metalink"; |
| 613 |
#endif |
| 614 |
qsort(&featp[0], numfeat, sizeof(char *), featcomp); |
| 615 |
for(i = 0; i< numfeat; i++) |
| 616 |
printf(" %s", featp[i]); |
| 617 |
puts(""); /* newline */ |
| 618 |
} |
| 619 |
if(strcmp(CURL_VERSION, curlinfo->version)) { |
| 620 |
printf("WARNING: curl and libcurl versions do not match. " |
| 621 |
"Functionality may be affected.\n"); |
| 622 |
} |
| 623 |
} |
| 624 |
|
| 625 |
void tool_list_engines(void) |
| 626 |
{ |
| 627 |
CURL *curl = curl_easy_init(); |
| 628 |
struct curl_slist *engines = NULL; |
| 629 |
|
| 630 |
/* Get the list of engines */ |
| 631 |
curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines); |
| 632 |
|
| 633 |
puts("Build-time engines:"); |
| 634 |
if(engines) { |
| 635 |
for(; engines; engines = engines->next) |
| 636 |
printf(" %s\n", engines->data); |
| 637 |
} |
| 638 |
else { |
| 639 |
puts(" <none>"); |
| 640 |
} |
| 641 |
|
| 642 |
/* Cleanup the list of engines */ |
| 643 |
curl_slist_free_all(engines); |
| 644 |
curl_easy_cleanup(curl); |
| 645 |
} |