mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibWeb: Remove OOM propagation from Fetch::Infrastructure::HTTP
This commit is contained in:
parent
1ffda6a805
commit
c9a461ee75
Notes:
sideshowbarker
2024-07-16 20:51:53 +09:00
Author: https://github.com/trflynn89
Commit: c9a461ee75
Pull-request: https://github.com/SerenityOS/serenity/pull/24124
5 changed files with 12 additions and 12 deletions
|
@ -12,7 +12,7 @@
|
|||
namespace Web::Fetch::Infrastructure {
|
||||
|
||||
// https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
|
||||
ErrorOr<String> collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value)
|
||||
String collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value)
|
||||
{
|
||||
// To collect an HTTP quoted string from a string input, given a position variable position and optionally an extract-value flag, run these steps:
|
||||
// 1. Let positionStart be position.
|
||||
|
@ -69,10 +69,10 @@ ErrorOr<String> collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStr
|
|||
|
||||
// 6. If the extract-value flag is set, then return value.
|
||||
if (extract_value == HttpQuotedStringExtractValue::Yes)
|
||||
return value.to_string();
|
||||
return MUST(value.to_string());
|
||||
|
||||
// 7. Return the code points from positionStart to position, inclusive, within input.
|
||||
return String::from_utf8(lexer.input().substring_view(position_start, lexer.tell() - position_start));
|
||||
return MUST(String::from_utf8(lexer.input().substring_view(position_start, lexer.tell() - position_start)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,6 @@ enum class HttpQuotedStringExtractValue {
|
|||
Yes,
|
||||
};
|
||||
|
||||
ErrorOr<String> collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value = HttpQuotedStringExtractValue::No);
|
||||
[[nodiscard]] String collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value = HttpQuotedStringExtractValue::No);
|
||||
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ Optional<Vector<String>> get_decode_and_split_header_value(ReadonlyBytes value)
|
|||
// 1. If the code point at position within input is U+0022 ("), then:
|
||||
if (lexer.peek() == '"') {
|
||||
// 1. Append the result of collecting an HTTP quoted string from input, given position, to temporaryValue.
|
||||
temporary_value_builder.append(MUST(collect_an_http_quoted_string(lexer)));
|
||||
temporary_value_builder.append(collect_an_http_quoted_string(lexer));
|
||||
|
||||
// 2. If position is not past the end of input, then continue.
|
||||
if (!lexer.is_eof())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue