mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibHTTP: Return a StringView from HTTP::normalize_header_value
This lets callers that do not need a string avoid a needless allocation. All callers that do need a string will already either: * Turn it into a ByteString themselves * Pass this along to the isomorphic encoder
This commit is contained in:
committed by
Shannon Booth
parent
5fe1a70c8e
commit
0652a33043
Notes:
github-actions[bot]
2026-02-26 21:29:09 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/0652a330438 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8193 Reviewed-by: https://github.com/shannonbooth ✅
@@ -79,7 +79,7 @@ bool is_header_value(StringView header_value)
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-header-value-normalize
|
||||
ByteString normalize_header_value(StringView potential_value)
|
||||
StringView normalize_header_value(StringView potential_value)
|
||||
{
|
||||
// To normalize a byte sequence potentialValue, remove any leading and trailing HTTP whitespace bytes from
|
||||
// potentialValue.
|
||||
|
||||
@@ -25,7 +25,7 @@ struct Header {
|
||||
|
||||
[[nodiscard]] bool is_header_name(StringView);
|
||||
[[nodiscard]] bool is_header_value(StringView);
|
||||
[[nodiscard]] ByteString normalize_header_value(StringView);
|
||||
[[nodiscard]] StringView normalize_header_value(StringView);
|
||||
|
||||
[[nodiscard]] bool is_forbidden_request_header(Header const&);
|
||||
[[nodiscard]] bool is_forbidden_response_header_name(StringView);
|
||||
|
||||
Reference in New Issue
Block a user