mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LibURL: Remove FIXME for stripping c0 control or space
The FIXME was not correct - this was done correctly. But let's use a helper to make the implementation slightly more readable.
This commit is contained in:
parent
670ce3ebb1
commit
4f5af3e90e
Notes:
github-actions[bot]
2024-08-05 16:22:24 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/4f5af3e90e5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/973 Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 4 additions and 7 deletions
|
@ -807,13 +807,10 @@ URL Parser::basic_parse(StringView raw_input, Optional<URL> const& base_url, Opt
|
|||
|
||||
// 2. If input contains any leading or trailing C0 control or space, invalid-URL-unit validation error.
|
||||
// 3. Remove any leading and trailing C0 control or space from input.
|
||||
//
|
||||
// FIXME: We aren't checking exactly for 'trailing C0 control or space' here.
|
||||
|
||||
bool has_validation_error = false;
|
||||
for (size_t i = 0; i < raw_input.length(); ++i) {
|
||||
i8 ch = raw_input[i];
|
||||
if (0 <= ch && ch <= 0x20) {
|
||||
u8 ch = raw_input[i];
|
||||
if (is_ascii_c0_control_or_space(ch)) {
|
||||
++start_index;
|
||||
has_validation_error = true;
|
||||
} else {
|
||||
|
@ -821,8 +818,8 @@ URL Parser::basic_parse(StringView raw_input, Optional<URL> const& base_url, Opt
|
|||
}
|
||||
}
|
||||
for (ssize_t i = raw_input.length() - 1; i >= 0; --i) {
|
||||
i8 ch = raw_input[i];
|
||||
if (0 <= ch && ch <= 0x20) {
|
||||
u8 ch = raw_input[i];
|
||||
if (is_ascii_c0_control_or_space(ch)) {
|
||||
--end_index;
|
||||
has_validation_error = true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue