mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -51,22 +51,22 @@ ByteBuffer HttpRequest::to_raw_request() const
|
|||
builder.append('?');
|
||||
builder.append(m_url.query());
|
||||
}
|
||||
builder.append(" HTTP/1.1\r\nHost: ");
|
||||
builder.append(" HTTP/1.1\r\nHost: "sv);
|
||||
builder.append(m_url.host());
|
||||
if (m_url.port().has_value())
|
||||
builder.appendff(":{}", *m_url.port());
|
||||
builder.append("\r\n");
|
||||
builder.append("\r\n"sv);
|
||||
for (auto& header : m_headers) {
|
||||
builder.append(header.name);
|
||||
builder.append(": ");
|
||||
builder.append(": "sv);
|
||||
builder.append(header.value);
|
||||
builder.append("\r\n");
|
||||
builder.append("\r\n"sv);
|
||||
}
|
||||
if (!m_body.is_empty()) {
|
||||
builder.appendff("Content-Length: {}\r\n\r\n", m_body.size());
|
||||
builder.append((char const*)m_body.data(), m_body.size());
|
||||
}
|
||||
builder.append("\r\n");
|
||||
builder.append("\r\n"sv);
|
||||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
|
@ -204,14 +204,14 @@ Optional<HttpRequest::Header> HttpRequest::get_http_basic_authentication_header(
|
|||
builder.append(url.password());
|
||||
auto token = encode_base64(builder.to_string().bytes());
|
||||
builder.clear();
|
||||
builder.append("Basic ");
|
||||
builder.append("Basic "sv);
|
||||
builder.append(token);
|
||||
return Header { "Authorization", builder.to_string() };
|
||||
}
|
||||
|
||||
Optional<HttpRequest::BasicAuthenticationCredentials> HttpRequest::parse_http_basic_authentication_header(String const& value)
|
||||
{
|
||||
if (!value.starts_with("Basic ", AK::CaseSensitivity::CaseInsensitive))
|
||||
if (!value.starts_with("Basic "sv, AK::CaseSensitivity::CaseInsensitive))
|
||||
return {};
|
||||
auto token = value.substring_view(6);
|
||||
if (token.is_empty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue