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