Skip to content

Commit

Permalink
Downloads: Improve error message url is invalid (#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort authored Jul 6, 2024
1 parent b749be7 commit 7e0d199
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vcpkg/base/downloads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,15 @@ namespace vcpkg
if (headers.size() == 0 && !needs_proxy_auth)
{
auto split_uri = split_uri_view(url).value_or_exit(VCPKG_LINE_INFO);
auto authority = split_uri.authority.value_or_exit(VCPKG_LINE_INFO).substr(2);
if (split_uri.scheme == "https" || split_uri.scheme == "http")
{
auto maybe_authority = split_uri.authority.get();
if (!maybe_authority)
{
Checks::msg_exit_with_error(VCPKG_LINE_INFO, msgInvalidUri, msg::value = url);
}

auto authority = maybe_authority->substr(2);
// This check causes complex URLs (non-default port, embedded basic auth) to be passed down to curl.exe
if (Strings::find_first_of(authority, ":@") == authority.end())
{
Expand Down

0 comments on commit 7e0d199

Please sign in to comment.