xref: /curl/docs/cmdline-opts/_ENVIRONMENT.md (revision f81f351b)
1<!-- Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. -->
2<!-- SPDX-License-Identifier: curl -->
3# ENVIRONMENT
4The environment variables can be specified in lower case or upper case. The
5lower case version has precedence. `http_proxy` is an exception as it is only
6available in lower case.
7
8Using an environment variable to set the proxy has the same effect as using
9the --proxy option.
10
11## `http_proxy` [protocol://]<host>[:port]
12Sets the proxy server to use for HTTP.
13
14## `HTTPS_PROXY` [protocol://]<host>[:port]
15Sets the proxy server to use for HTTPS.
16
17## `[url-protocol]_PROXY` [protocol://]<host>[:port]
18Sets the proxy server to use for [url-protocol], where the protocol is a
19protocol that curl supports and as specified in a URL. FTP, FTPS, POP3, IMAP,
20SMTP, LDAP, etc.
21
22## `ALL_PROXY` [protocol://]<host>[:port]
23Sets the proxy server to use if no protocol-specific proxy is set.
24
25## `NO_PROXY` <comma-separated list of hosts/domains>
26list of hostnames that should not go through any proxy. If set to an asterisk
27'*' only, it matches all hosts. Each name in this list is matched as either a
28domain name which contains the hostname, or the hostname itself.
29
30This environment variable disables use of the proxy even when specified with
31the --proxy option. That is
32
33    NO_PROXY=direct.example.com curl -x http://proxy.example.com
34    http://direct.example.com
35
36accesses the target URL directly, and
37
38    NO_PROXY=direct.example.com curl -x http://proxy.example.com
39    http://somewhere.example.com
40
41accesses the target URL through the proxy.
42
43The list of hostnames can also be include numerical IP addresses, and IPv6
44versions should then be given without enclosing brackets.
45
46IP addresses can be specified using CIDR notation: an appended slash and
47number specifies the number of "network bits" out of the address to use in the
48comparison (added in 7.86.0). For example "192.168.0.0/16" would match all
49addresses starting with "192.168".
50
51## `APPDATA` <dir>
52On Windows, this variable is used when trying to find the home directory. If
53the primary home variable are all unset.
54
55## `COLUMNS` <terminal width>
56If set, the specified number of characters is used as the terminal width when
57the alternative progress-bar is shown. If not set, curl tries to figure it out
58using other ways.
59
60## `CURL_CA_BUNDLE` <file>
61If set, it is used as the --cacert value. This environment variable is ignored
62if Schannel is used as the TLS backend.
63
64## `CURL_HOME` <dir>
65If set, is the first variable curl checks when trying to find its home
66directory. If not set, it continues to check *XDG_CONFIG_HOME*
67
68## `CURL_SSL_BACKEND` <TLS backend>
69If curl was built with support for "MultiSSL", meaning that it has built-in
70support for more than one TLS backend, this environment variable can be set to
71the case insensitive name of the particular backend to use when curl is
72invoked. Setting a name that is not a built-in alternative makes curl stay
73with the default.
74
75SSL backend names (case-insensitive): **bearssl**, **gnutls**, **mbedtls**,
76**openssl**, **rustls**, **schannel**, **secure-transport**, **wolfssl**
77
78## `HOME` <dir>
79If set, this is used to find the home directory when that is needed. Like when
80looking for the default .curlrc. *CURL_HOME* and *XDG_CONFIG_HOME*
81have preference.
82
83## `QLOGDIR` <directory name>
84If curl was built with HTTP/3 support, setting this environment variable to a
85local directory makes curl produce **qlogs** in that directory, using file
86names named after the destination connection id (in hex). Do note that these
87files can become rather large. Works with the ngtcp2 and quiche QUIC backends.
88
89## `SHELL`
90Used on VMS when trying to detect if using a **DCL** or a **Unix** shell.
91
92## `SSL_CERT_DIR` <dir>
93If set, it is used as the --capath value. This environment variable is ignored
94if Schannel is used as the TLS backend.
95
96## `SSL_CERT_FILE` <path>
97If set, it is used as the --cacert value. This environment variable is ignored
98if Schannel is used as the TLS backend.
99
100## `SSLKEYLOGFILE` <filename>
101If you set this environment variable to a filename, curl stores TLS secrets
102from its connections in that file when invoked to enable you to analyze the
103TLS traffic in real time using network analyzing tools such as Wireshark. This
104works with the following TLS backends: OpenSSL, LibreSSL (TLS 1.2 max),
105BoringSSL, GnuTLS and wolfSSL.
106
107## `USERPROFILE` <dir>
108On Windows, this variable is used when trying to find the home directory. If
109the other, primary, variable are all unset. If set, curl uses the path
110**"$USERPROFILE\Application Data"**.
111
112## `XDG_CONFIG_HOME` <dir>
113If *CURL_HOME* is not set, this variable is checked when looking for a
114default .curlrc file.
115