Skip to content

Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value#1988

Merged
BillyONeal merged 3 commits intomicrosoft:mainfrom
TobiasFunk:main
Apr 15, 2026
Merged

Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value#1988
BillyONeal merged 3 commits intomicrosoft:mainfrom
TobiasFunk:main

Conversation

@TobiasFunk
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 10, 2026 08:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Windows tls12-download bootstrap downloader’s proxy environment-variable handling so that an explicitly empty proxy variable is treated as “unset” (rather than triggering an error path), aligning behavior with common proxy-env conventions.

Changes:

  • Add abort_api_failure_with_last_error() to preserve the originating Win32 error code across intermediate calls.
  • Change GetEnvironmentVariableW() handling for HTTPS_PROXY/NO_PROXY to treat an empty value as “no proxy / no bypass” by explicitly initializing and then checking GetLastError().

Comment thread src/tls12-download.c
Comment on lines +217 to 223
SetLastError(ERROR_SUCCESS);
DWORD get_result = GetEnvironmentVariableW(L"HTTPS_PROXY", https_proxy_env, sizeof(https_proxy_env) / sizeof(wchar_t));
DWORD last_error = GetLastError();
if (get_result)
{
access_type = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
proxy_setting = https_proxy_env;
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title refers to HTTP_PROXY, but this code path only reads HTTPS_PROXY (and then falls back to IE proxy). If the intent is to honor/ignore HTTP_PROXY as well, please add handling for it (or clarify/update the PR title to match the implemented behavior).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have fixed the PR title and commit message

@TobiasFunk TobiasFunk changed the title Ignore HTTP_PROXY if env variable is set to empty value (#1987) Ignore HTTPS_PROXY if env variable is set to empty value (#1987) Apr 10, 2026
@TobiasFunk TobiasFunk changed the title Ignore HTTPS_PROXY if env variable is set to empty value (#1987) Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value (#1987) Apr 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted a nitpick and fix the formatting check for you in TobiasFunk#1

BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this pull request Apr 15, 2026
This is a followup to microsoft#1988 where I observe that the same type of defect applies to the "normal" way vcpkg gets environment variables.

Ensure that this is preserved correctly, enable use of the small string optimization for wstring, and audit all callers.
@BillyONeal BillyONeal changed the title Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value (#1987) Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value Apr 15, 2026
Fix formatting and remove unnecessary parens.
@BillyONeal BillyONeal enabled auto-merge (squash) April 15, 2026 19:05
@BillyONeal BillyONeal merged commit d516570 into microsoft:main Apr 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants