mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 12:36:01 +01:00
libutil: Use Boost.URL in parseURL
Boost.URL is a significantly more RFC-compliant parser than what libutil currently has a bundle of incomprehensible regexes. One aspect of this change is that RFC4007 ZoneId IPv6 literals are represented in URIs according to RFC6874 [1]. Previously they were represented naively like so: [fe80::818c:da4d:8975:415c\%enp0s25]. This is not entirely correct, because the percent itself has to be pct-encoded: > "%" is always treated as an escape character in a URI, so, according to the established URI syntax [RFC3986] any occurrences of literal "%" symbols in a URI MUST be percent-encoded and represented in the form "%25". Thus, the scoped address fe80::a%en1 would appear in a URI as http://[fe80::a%25en1]. [1]: https://datatracker.ietf.org/doc/html/rfc6874 Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
parent
d020f21a2a
commit
bd1d2d1041
4 changed files with 81 additions and 45 deletions
|
|
@ -124,9 +124,9 @@ TEST(parseURL, parseIPv4Address)
|
|||
ASSERT_EQ(parsed, expected);
|
||||
}
|
||||
|
||||
TEST(parseURL, parseScopedRFC4007IPv6Address)
|
||||
TEST(parseURL, parseScopedRFC6874IPv6Address)
|
||||
{
|
||||
auto s = "http://[fe80::818c:da4d:8975:415c\%enp0s25]:8080";
|
||||
auto s = "http://[fe80::818c:da4d:8975:415c\%25enp0s25]:8080";
|
||||
auto parsed = parseURL(s);
|
||||
|
||||
ParsedURL expected{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue