mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 15:02:56 +00:00
LibWeb: Return the correct substring when parsing an HTTP quoted string
We were off-by-one when returning the result of parsing a quoted string in Web::Fetch::Infrastructure::collect_an_http_quoted_string. Instead of backtracking the lexer and consuming the backtracked string, do a simple substring operation.
This commit is contained in:
parent
576c2f4f4d
commit
d74059580c
Notes:
sideshowbarker
2024-07-17 05:19:06 +09:00
Author: https://github.com/trflynn89
Commit: d74059580c
Pull-request: https://github.com/SerenityOS/serenity/pull/23730
Reviewed-by: https://github.com/Lubrsi ✅
4 changed files with 72 additions and 4 deletions
|
@ -72,10 +72,7 @@ ErrorOr<String> collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStr
|
|||
return value.to_string();
|
||||
|
||||
// 7. Return the code points from positionStart to position, inclusive, within input.
|
||||
auto position = lexer.tell();
|
||||
auto number_of_characters_to_consume = position - position_start + 1;
|
||||
lexer.retreat(number_of_characters_to_consume);
|
||||
return String::from_utf8(lexer.consume(number_of_characters_to_consume));
|
||||
return String::from_utf8(lexer.input().substring_view(position_start, lexer.tell() - position_start));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue