Commit graph

7 commits

Author SHA1 Message Date
Shannon Booth
fc740068d2 LibURL/Pattern: Avoid eliding default ports in port patterns 2026-06-15 13:45:37 +02:00
Tim Ledbetter
3771bd5d4a LibURL: Advance past the '@' delimiter after batch-parsing userinfo
After batch-processing the userinfo, the authority state advanced the
parse pointer onto the '@' and relied on the end-of-loop increment to
step past it. That increment uses the byte length of the authority's
first code point, not the delimiter's. When the first code point was
multi-byte, the pointer overshot into the middle of a code point and
the next iteration sliced the string at a non-char boundary causing the
process to panic. We now step past the delimiter explicitly so we don't
need to rely on the end of loop increment to do so.
2026-06-07 11:29:43 +01:00
Shannon Booth
b4f46211d2 LibURL: Replace WTF-8 surrogates before Rust URL parsing
The Rust URL FFI used String::from_utf8_lossy() on raw bytes from C++.
That was not equivalent to the old C++ parser behavior for WTF-8 encoded
surrogates. For example a byte sequence such as ED A0 80 was treated as
three invalid UTF-8 bytes, producing three U+FFFD replacement
characters.

Instead use String::from_utf8_with_replacement_character and let Rust
borrow the input as &str.
2026-05-30 01:41:34 +02:00
Shannon Booth
4a986de52f LibURL: Optimize ASCII path/query parsing
Copy contiguous ASCII path/query runs in one slice append, instead of
processing each code point individually. Fall back to the normal state
machine for delimiters, percent escapes, non-ASCII input, and validation
cases.

This gives a 2.4x speedup on a benchmark parsing common web URLs.
2026-05-28 09:27:41 +02:00
Shannon Booth
57cc7b04ee LibURL: Expose rust host parsing over FFI
To be used instead of the C++ implementation.
2026-05-28 09:27:41 +02:00
Shannon Booth
b31e0df363 LibURL: Implement URLPattern in Rust 2026-05-28 09:27:41 +02:00
Shannon Booth
d44ff6628f LibURL: Implement a URL parser in rust 2026-05-28 09:27:41 +02:00