Skip to content

Commit 749559c

Browse files
Remove trailing '/' from environment HTTP_PROXY variable fixes #45678 (#1690)
Co-authored-by: Billy Robert O'Neal III <[email protected]>
1 parent 788766a commit 749559c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/vcpkg/base/downloads.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,14 @@ namespace vcpkg
354354
auto maybe_https_proxy_env = get_environment_variable(EnvironmentVariableHttpsProxy);
355355
if (auto p_https_proxy = maybe_https_proxy_env.get())
356356
{
357-
std::wstring env_proxy_settings = Strings::to_utf16(*p_https_proxy);
357+
StringView p_https_proxy_view = *p_https_proxy;
358+
if (p_https_proxy_view.size() != 0 && p_https_proxy_view.back() == '/')
359+
{
360+
// remove trailing slash
361+
p_https_proxy_view = p_https_proxy_view.substr(0, p_https_proxy_view.size() - 1);
362+
}
363+
364+
std::wstring env_proxy_settings = Strings::to_utf16(p_https_proxy_view);
358365
WINHTTP_PROXY_INFO proxy;
359366
proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
360367
proxy.lpszProxy = env_proxy_settings.data();

0 commit comments

Comments
 (0)