url: fall back to http/https proxy env-variable if ws/wss not set

Reported-by: Craig Andrews
Fixes #12031
Closes #12058
This commit is contained in:
Daniel Stenberg 2023-10-07 21:13:04 +02:00
parent b9c78eeac1
commit 43215842f2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 36 additions and 21 deletions

View file

@ -30,16 +30,20 @@ controls and changes behaviors. This is the full list of variables to set and
description of what they do. Also note that curl, the command line tool,
supports a set of additional environment variables independently of this.
.IP "[scheme]_proxy"
When libcurl is given a URL to use in a transfer, it first extracts the
"scheme" part from the URL and checks if there is a given proxy set for that
in its corresponding environment variable. A URL like "https://example.com"
makes libcurl use the "http_proxy" variable, while a URL like
"ftp://example.com" uses the "ftp_proxy" variable.
When libcurl is given a URL to use in a transfer, it first extracts the scheme
part from the URL and checks if there is a given proxy set for that in its
corresponding environment variable. A URL like https://example.com makes
libcurl use the \fBhttp_proxy\fP variable, while a URL like ftp://example.com
uses the \fBftp_proxy\fP variable.
These proxy variables are also checked for in their uppercase versions, except
the "http_proxy" one which is only used lowercase. Note also that some systems
actually have a case insensitive handling of environment variables and then of
course "HTTP_PROXY" still works.
the \fBhttp_proxy\fP one which is only used lowercase. Note also that some
systems actually have a case insensitive handling of environment variables and
then of course \fBHTTP_PROXY\fP still works.
An exception exists for the WebSocket \fBws\fP and \fBwss\fP URL schemes,
where libcurl first checks \fBws_proxy\fP or \fBwss_proxy\fP but if they are
not set, it will fall back and try the http and https versions instead if set.
.IP ALL_PROXY
This is a setting to set proxy for all URLs, independently of what scheme is
being used. Note that the scheme specific variables overrides this one if set.