Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value#1988
Ignore HTTPS_PROXY and NO_PROXY if env variable is set to empty value#1988BillyONeal merged 3 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
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 forHTTPS_PROXY/NO_PROXYto treat an empty value as “no proxy / no bypass” by explicitly initializing and then checkingGetLastError().
| 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; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
i have fixed the PR title and commit message
BillyONeal
left a comment
There was a problem hiding this comment.
I submitted a nitpick and fix the formatting check for you in TobiasFunk#1
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.
Fix formatting and remove unnecessary parens.
No description provided.