Match libcurl lowercase proxy environment variable behaviour #503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
libcurl supports multiple different environment variables1 to configure proxy behaviour: http_proxy, https_proxy, all_proxy, and no_proxy.
Unlike most other environment variables these proxy envars are normally lowercase, not uppercase. This convention was set by libwww back in the early 1990s. When libcurl was first released however, it was not aware of this schism and only implemented checks for uppercase variants of these envars: HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and NO_PROXY.
In time, libcurl learned to also read the lowercase variants, and gives them precedence over the uppercase forms (since the former are quasi-standards).
However, to further complicate the matter, libcurl no longer reads the uppercase HTTP_PROXY variable specifically. This change was made to address a security concern with some CGI webservers2.
The problem is that today GCM only reads the uppercase variants of the environment variables! This is inconsistent with libcurl, and therefore Git's behaviour (that we aim to be consistent/co-operative with).
We change GCM's behaviour to match that of libcurl/Git in that the lowercase proxy envars are preferred to the uppercase ones, and the uppercase HTTP_PROXY variable is ignored.
Dropping support for the HTTP_PROXY uppercase envar is technically a breaking change, but if the user had only set this uppercase envar then Git would not be proxying the actual remote calls, only GCM, which is most likely not what the user wanted.