mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:18:13 +00:00
LibWeb: Make extract_header_list_values differentiate parsing failures
Previously, parsing failures and the header not existing made extract_header_list_values return an empty Optional, making it impossible to differentiate between the two. Required for implementing CORS-preflight, where parsing failures for the headers makes it fail, but not having them doesn't make it fail in all cases.
This commit is contained in:
parent
bf2895365b
commit
237df9df5c
3 changed files with 14 additions and 9 deletions
|
@ -59,6 +59,9 @@ struct RangeHeaderValue {
|
|||
Optional<u64> end;
|
||||
};
|
||||
|
||||
struct ExtractHeaderParseFailure {
|
||||
};
|
||||
|
||||
[[nodiscard]] ErrorOr<Optional<Vector<DeprecatedString>>> get_decode_and_split_header_value(ReadonlyBytes);
|
||||
[[nodiscard]] ErrorOr<OrderedHashTable<ByteBuffer>> convert_header_names_to_a_sorted_lowercase_set(Span<ReadonlyBytes>);
|
||||
[[nodiscard]] bool is_header_name(ReadonlyBytes);
|
||||
|
@ -76,7 +79,7 @@ struct RangeHeaderValue {
|
|||
[[nodiscard]] bool is_forbidden_response_header_name(ReadonlyBytes);
|
||||
[[nodiscard]] bool is_request_body_header_name(ReadonlyBytes);
|
||||
[[nodiscard]] ErrorOr<Optional<Vector<ByteBuffer>>> extract_header_values(Header const&);
|
||||
[[nodiscard]] ErrorOr<Optional<Vector<ByteBuffer>>> extract_header_list_values(ReadonlyBytes, HeaderList const&);
|
||||
[[nodiscard]] ErrorOr<Variant<Vector<ByteBuffer>, ExtractHeaderParseFailure, Empty>> extract_header_list_values(ReadonlyBytes, HeaderList const&);
|
||||
[[nodiscard]] Optional<RangeHeaderValue> parse_single_range_header_value(ReadonlyBytes);
|
||||
[[nodiscard]] ErrorOr<ByteBuffer> default_user_agent_value();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue