1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00

AK: Port URL username/password from DeprecatedString to String

And for cases that just need to check whether the password/username is
empty, add a raw_{password,username} helper to avoid any allocation.
This commit is contained in:
Shannon Booth 2023-08-12 16:52:38 +12:00 committed by Andrew Kaster
parent 6b29dc3e46
commit 55a01e72ca
11 changed files with 44 additions and 39 deletions

View file

@ -252,9 +252,9 @@ Optional<HttpRequest::Header> HttpRequest::get_http_basic_authentication_header(
if (!url.includes_credentials())
return {};
StringBuilder builder;
builder.append(url.username());
builder.append(url.username().release_value_but_fixme_should_propagate_errors());
builder.append(':');
builder.append(url.password());
builder.append(url.password().release_value_but_fixme_should_propagate_errors());
// FIXME: change to TRY() and make method fallible
auto token = MUST(encode_base64(MUST(builder.to_string()).bytes()));