LibURL+LibWeb: Do not percent decode in password/username getters

Doing it is not part of the spec. Whenever needed, the spec will
explicitly percent decode the username and password.

This fixes some URL WPT tests.
This commit is contained in:
Shannon Booth 2024-08-04 22:02:02 +12:00 committed by Tim Ledbetter
commit f511c0b441
Notes: github-actions[bot] 2024-08-04 11:59:57 +00:00
14 changed files with 62 additions and 45 deletions

View file

@ -1810,7 +1810,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
// true, set authorizationValue to httpRequests current URL, converted to an `Authorization` value.
else if (http_request->current_url().includes_credentials() && is_authentication_fetch == IsAuthenticationFetch::Yes) {
auto const& url = http_request->current_url();
auto payload = MUST(String::formatted("{}:{}", MUST(url.username()), MUST(url.password())));
auto payload = MUST(String::formatted("{}:{}", URL::percent_decode(url.username()), URL::percent_decode(url.password())));
authorization_value = TRY_OR_THROW_OOM(vm, encode_base64(payload.bytes()));
}