Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions runtime-light/server/http/init-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,14 @@ std::string_view process_headers(const tl::K2InvokeHttp& invoke_http, PhpScriptB
http_server_instance_st.encoding |= HttpServerInstanceState::ENCODING_DEFLATE;
}
} else if (h_name == kphp::http::headers::CONNECTION) {
if (h_value == CONNECTION_KEEP_ALIVE) [[likely]] {
static constexpr auto IEQUALS{[](std::string_view s1, std::string_view s2) noexcept {
return std::ranges::equal(s1, s2,
[](char a, char b) noexcept { return std::tolower(a, std::locale::classic()) == std::tolower(b, std::locale::classic()); });
}};

if (IEQUALS(h_value, CONNECTION_KEEP_ALIVE)) [[likely]] {
http_server_instance_st.connection_kind = kphp::http::connection_kind::keep_alive;
} else if (h_value == CONNECTION_CLOSE) [[likely]] {
} else if (IEQUALS(h_value, CONNECTION_CLOSE)) [[likely]] {
http_server_instance_st.connection_kind = kphp::http::connection_kind::close;
} else {
kphp::log::error("unexpected connection header: {}", h_value);
Expand Down
Loading