#compdef curl

# curl zsh completion

local curcontext="$curcontext" state state_descr line
typeset -A opt_args

local rc=1

_arguments -C -S \
  --retry-delay'[When retrying, wait this many seconds between each]':<seconds> \
  --ftp-account'[Account data to send when requested by server (F)]':<data> \
  --ftp-alternative-to-user'[String to replace "USER \[name\]" (F)]':<cmd> \
  --engine'[Crypto engine to use (SSL). "--engine list" for list]':<eng> \
  --retry'[Retry request <num> times if transient problems occur]':<num> \
  --capath'[CA directory (made using c_rehash) to verify]':<directory> \
  --compressed'[Request compressed response (using deflate or gzip)]' \
  --interface'[Specify network interface/address to use]':<interface> \
  --location-trusted'[Location: and send authentication even]':Follow \
  --3p-quote'[like -Q for the source URL for 3rd party transfer (F)]' \
  --connect-timeout'[Maximum time allowed for connection]':<seconds> \
  --proxy-negotiate'[Negotiate authentication on the proxy (H)]':Use \
  --local-port'[Force use of these local port numbers]':<num>[-num] \
  --ftp-method'[Control CWD usage (F)]':[multicwd/nocwd/singlecwd] \
  --ignore-content-length'[Ignore the HTTP Content-Length header]' \
  --3p-user'[user and password for source 3rd party transfer (F)]' \
  --cert-type'[Certificate file type (DER/PEM/ENG) (SSL)]':<type> \
  --krb4'[Enable krb4 with specified security level (F)]':<level> \
  --random-file'[File for reading random data from (SSL)]':<file> \
  --socks4'[Use SOCKS4 proxy on given host + port]':<host[:port]> \
  --socks5'[Use SOCKS5 proxy on given host + port]':<host[:port]> \
  --trace-ascii'[Like --trace but without the hex output]':<file> \
  --key-type'[Private key file type (DER/PEM/ENG) (SSL)]':<type> \
  --cacert'[CA certificate to verify peer against (SSL)]':<file> \
  --ftp-create-dirs'[the remote dirs if not present (F)]':Create \
  --max-redirs'[Maximum number of redirects allowed (H)]':<num> \
  --max-filesize'[Maximum file size to download (H/F)]':<bytes> \
  --proxy-anyauth'["any" proxy authentication method (H)]':Pick \
  --proxy-digest'[Use Digest authentication on the proxy (H)]' \
  --create-dirs'[Create necessary local directory hierarchy]' \
  --form-string'[Specify HTTP multipart POST data (H)]':<name=string> \
  --retry-max-time'[Retry only within this period]':<seconds> \
  --stderr'[Where to redirect stderr. - means stdout]':<file> \
  --egd-file'[EGD socket path for random data (SSL)]':<file> \
  --ftp-ssl-reqd'[Require SSL/TLS for the ftp transfer (F)]' \
  --netrc-optional'[either .netrc or URL; overrides -n]':Use \
  --proxy-basic'[Use Basic authentication on the proxy (H)]' \
  --3p-url'[source URL to activate 3rd party transfer (F)]' \
  --limit-rate'[Limit transfer speed to this rate]':<rate> \
  --proxy-ntlm'[Use NTLM authentication on the proxy (H)]' \
  --pass'[<pass>  Pass phrase for the private key (SSL)]' \
  --trace'[Write a debug trace to the given file]':<file> \
  --trace-time'[Add time stamps to trace/verbose output]' \
  --ftp-skip-pasv-ip'[the IP address for PASV (F)]':Skip \
  --negotiate'[Use HTTP Negotiate Authentication (H)]' \
  --delegation'[GSS-API delegation permission]':STRING \
  --anyauth'[Pick "any" authentication method (H)]' \
  --data-binary'[HTTP POST binary data (H)]':<data> \
  --ftp-ssl'[Try SSL/TLS for the ftp transfer (F)]' \
  --disable-eprt'[Inhibit using EPRT or LPRT (F)]' \
  --data-ascii'[HTTP POST ASCII data (H)]':<data> \
  --ftp-pasv'[Use PASV/EPSV instead of PORT (F)]' \
  --digest'[Use HTTP Digest Authentication (H)]' \
  --basic'[Use HTTP Basic Authentication (H)]' \
  --ciphers'[SSL ciphers to use (SSL)]':<list> \
  --tcp-nodelay'[Use the TCP_NODELAY option]' \
  --key'[Private key file name (SSL)]':<key> \
  --ntlm'[Use HTTP NTLM authentication (H)]' \
  --disable-epsv'[Inhibit using EPSV (F)]' \
  --crlf'[Convert LF to CRLF in upload]' \
  --url'[Spet URL to work with]':<URL> \
  '*:URL:_urls' && rc=0

return rc
