curl/curl
User-facing surface splits in two. The `curl` tool exposes ~298 documented command-line options plus higher-level conveniences: URL globbing, parallel transfers, retry policies, ETag compare/store, `--write-out` templating (including JSON), config files, user-defined `--variable` expansion, `--libcurl` source generation, and xattr metadata. libcurl exposes ~91 documented API functions and ~422 documented options, covering the easy, multi, share, URL, header, mime, and WebSocket APIs. Protocol coverage is the headline feature: HTTP/1.1, HTTP/2, HTTP/3, FTP(S), SFTP/SCP, SMTP/IMAP/POP3, LDAP(S), MQTT, RTSP, TFTP, DICT, Gopher, Telnet, WS(S), and local `file`. Authentication and proxying are each their own subsystem with many interchangeable mechanisms.
- The command-line grammar is a single alphabetically-sorted `aliases[]` table of `struct LongShort` (long name, ARG_* type bits such as ARG_BOOL/ARG_FILE/ARG_STRG/ARG_SECS plus ARG_NO/ARG_TLS/ARG_CLEAR modifiers, short letter, and a `C_*` id); `findlongopt()`/`findshortopt()` resolve into it.
- Every command-line option has a matching curldown page — 298 files under docs/cmdline-opts/ — and the underscore-prefixed ones (`_OPTIONS.md`, `_GLOBBING.md`, `_VARIABLES.md`, `_EXITCODES.md`) are the manpage's prose sections.
- `--parallel` switches the tool from `serial_transfers()` to `parallel_transfers()`, which drives a real `CURLM` with `CURLMOPT_MAX_HOST_CONNECTIONS`, a notify callback, and `curl_multi_poll()`/`curl_multi_perform()`; concurrency is capped by `MAX_PARALLEL`/`MAX_PARALLEL_HOST` with `PARALLEL_DEFAULT` as the default.
- URL globbing (`http://host/[1-100]`, `{a,b}`) is implemented in src/tool_urlglob.c and feeds `glob_match_url()`, which also resolves `#1`..`#9` back-references when composing output filenames.
- `--write-out` is table-driven: a `writeoutvar variables[]` array maps names like `http_code`, `time_total`, `num_retries`, `conn_id`, `filename_effective` to a CURLINFO id and a writer function, with `%{json}`, `%{header_json}`, `%header{}`, `%time{}` and `%output{}` handled as special forms.
- `--libcurl <file>` makes the tool emit an equivalent C program: `easysrc_init()`/`easysrc_perform()`/`dumpeasysrc()` are wired into `operate()` and the serial loop, and the `my_setopt*` macros in src/tool_setopt.c double as source emitters.
- `--variable` supports environment expansion with functions: src/var.c reads `getenv(name)` directly (rather than `curl_getenv()`) specifically so that a blank-but-set variable is distinguishable.
- IPFS/IPNS URLs are a tool-level feature that reads `IPFS_GATEWAY`, then falls back to `IPFS_PATH`, then `$HOME/.ipfs/gateway`, rewriting `ipfs://` into an HTTP gateway request.
- Transfer resilience is a tool feature, not a library one: `retrycheck()` retries on timeouts/resolve failures, on HTTP 408/429/500/502/503/504/522/524, on FTP 4xx, on `--retry-connrefused`, and on `--retry-all-errors`, truncating the output file before each new attempt.
- HTTP/3 ships with two interchangeable QUIC backends — ngtcp2 (`lib/vquic/cf-ngtcp2.c`) and quiche (`lib/vquic/cf-quiche.c`) — each registering a `Curl_cft_http3` filter, plus an experimental HTTP/3 proxy path via `cf-ngtcp2-proxy.c` and CONNECT-UDP capsules.
- WebSocket support is a public API (`curl_ws_recv()`, `curl_ws_send()`, `curl_ws_meta()`) declared in include/curl/websockets.h and implemented in lib/ws.c with frame-level fragmentation handling.
- Authentication mechanisms are pluggable per-mechanism files under lib/vauth/: cleartext, CRAM-MD5, DIGEST (native and SSPI), NTLM (native and SSPI), Kerberos 5 (GSSAPI and SSPI), SPNEGO (GSSAPI and SSPI), OAuth2, and GSASL.
- Request signing is supported for two schemes: AWS SigV4 (`lib/http_aws_sigv4.c`, `--aws-sigv4`) and HTTP Message Signatures (`lib/http_httpsig.c`, wired through `httpsig_setopts()` with `CURLOPT_HTTPSIG_ALGORITHM`/`CURLOPT_HTTPSIG_KEY`).
- DNS-over-HTTPS is implemented as sub-transfers: `Curl_doh()` spins up to three probes (A, AAAA, HTTPS RR) as separate easy handles attached to the parent via `CURL_EZM_DOH_PROBE` metadata and a `sub_xfer_done` callback.
- Proxy support spans SOCKS4/4a/5/5h (`lib/socks.c` plus GSSAPI/SSPI variants), HTTP proxies with CONNECT tunneling over HTTP/1 and HTTP/2 (`lib/cf-h1-proxy.c`, `lib/cf-h2-proxy.c`), and the HAProxy PROXY protocol header (`lib/cf-haproxy.c`).