mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibURL/Pattern: Do not trim whitespace interpreting port
It turns out that the problem here was simply that we were trimming trailing whitespace when we did not need to, which was meaning that the port number of '80 ' was being converted to the empty string per URLPattern elision as the port matches the http scheme.
This commit is contained in:
parent
25e343464d
commit
8b2644a630
2 changed files with 4 additions and 4 deletions
|
@ -95,7 +95,7 @@ PatternErrorOr<Pattern> Pattern::create(Input const& input, Optional<String> con
|
|||
// 6. If processedInit["protocol"] is a special scheme and processedInit["port"] is a string which represents its
|
||||
// corresponding default port in radix-10 using ASCII digits then set processedInit["port"] to the empty string.
|
||||
if (is_special_scheme(processed_init.protocol.value())) {
|
||||
auto maybe_port = processed_init.port->to_number<u16>();
|
||||
auto maybe_port = processed_init.port->to_number<u16>(TrimWhitespace::No);
|
||||
if (maybe_port.has_value() && *maybe_port == default_port_for_scheme(*processed_init.protocol).value())
|
||||
processed_init.port = String {};
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 354 tests
|
||||
|
||||
351 Pass
|
||||
3 Fail
|
||||
352 Pass
|
||||
2 Fail
|
||||
Pass Loading data...
|
||||
Pass Pattern: [{"pathname":"/foo/bar"}] Inputs: [{"pathname":"/foo/bar"}]
|
||||
Pass Pattern: [{"pathname":"/foo/bar"}] Inputs: [{"pathname":"/foo/ba"}]
|
||||
|
@ -170,7 +170,7 @@ Pass Pattern: [{"pathname":":
|
|||
Pass Pattern: [{"port":""}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
Pass Pattern: [{"protocol":"http","port":"80"}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
Pass Pattern: [{"protocol":"http","port":"80{20}?"}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
Fail Pattern: [{"protocol":"http","port":"80 "}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
Pass Pattern: [{"protocol":"http","port":"80 "}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
Pass Pattern: [{"protocol":"http","port":"100000"}] Inputs: [{"protocol":"http","port":"100000"}]
|
||||
Pass Pattern: [{"port":"80"}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
Pass Pattern: [{"protocol":"http{s}?","port":"80"}] Inputs: [{"protocol":"http","port":"80"}]
|
||||
|
|
Loading…
Add table
Reference in a new issue