mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:17:45 +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())
|
||||
|
|
|
@ -370,7 +370,7 @@ void Job::on_socket_connected()
|
|||
return deferred_invoke([this] { did_fail(Core::NetworkJob::Error::ProtocolFailed); });
|
||||
}
|
||||
auto value = line.substring(name.length() + 2, line.length() - name.length() - 2);
|
||||
if (name.equals_ignoring_case("Set-Cookie")) {
|
||||
if (name.equals_ignoring_case("Set-Cookie"sv)) {
|
||||
dbgln_if(JOB_DEBUG, "Job: Received Set-Cookie header: '{}'", value);
|
||||
m_set_cookie_headers.append(move(value));
|
||||
|
||||
|
@ -388,11 +388,11 @@ void Job::on_socket_connected()
|
|||
} else {
|
||||
m_headers.set(name, value);
|
||||
}
|
||||
if (name.equals_ignoring_case("Content-Encoding")) {
|
||||
if (name.equals_ignoring_case("Content-Encoding"sv)) {
|
||||
// Assume that any content-encoding means that we can't decode it as a stream :(
|
||||
dbgln_if(JOB_DEBUG, "Content-Encoding {} detected, cannot stream output :(", value);
|
||||
m_can_stream_response = false;
|
||||
} else if (name.equals_ignoring_case("Content-Length")) {
|
||||
} else if (name.equals_ignoring_case("Content-Length"sv)) {
|
||||
auto length = value.to_uint();
|
||||
if (length.has_value())
|
||||
m_content_length = length.value();
|
||||
|
@ -485,7 +485,7 @@ void Job::on_socket_connected()
|
|||
auto encoding = transfer_encoding.value().trim_whitespace();
|
||||
|
||||
dbgln_if(JOB_DEBUG, "Job: This content has transfer encoding '{}'", encoding);
|
||||
if (encoding.equals_ignoring_case("chunked")) {
|
||||
if (encoding.equals_ignoring_case("chunked"sv)) {
|
||||
m_current_chunk_remaining_size = -1;
|
||||
goto read_chunk_size;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue