diff --git a/url.bs b/url.bs index 3fd9afa1..76109441 100644 --- a/url.bs +++ b/url.bs @@ -1947,11 +1947,18 @@ the blob URL store between parsing and fetching, while fetching will stil
A URL path is either a URL path segment or a list of zero -or more URL path segments. +or more URL path segments. In the latter case the URL path segments never contain +U+002F (/).
A URL path segment is an ASCII string. It commonly refers to a directory or a file, but has no predefined meaning. +
A URL path that is a URL path segment is
+opaque and can contain U+002F (/), as with
+web+demo:a/b. The URL parser never produces one that starts with U+002F (/), but
+URL Pattern does while canonicalizing patterns, so that is not an invariant.
+[[URLPATTERN]]
+
A
single-dot URL path segment
is a URL path segment that is "." or an ASCII case-insensitive
@@ -3220,16 +3227,19 @@ these steps. They return an ASCII string.
The URL path serializer takes a -URL url and then runs these steps. They return an ASCII string. +URL or URL path urlOrPath and then runs these steps. They +return an ASCII string.
If url has an opaque path, then return url's - path. +
Let path be urlOrPath's path if urlOrPath is + a URL; otherwise urlOrPath. + +
If path is a URL path segment, then return path.
Let output be the empty string. -
For each segment of url's path: append - U+002F (/) followed by segment to output. +
For each segment of path: append U+002F (/) followed + by segment to output.
Return output.
To determine whether a URL path A +equals URL path B, run these +steps. They return a boolean. + +
If A is a URL path segment or B is a + URL path segment, then return whether A is B. + +
For each index of A's indices: if + A[index] is not B[index], then return false. + +
Return true. +
Comparing URL path segments rather than serializations can matter as
+distinct URL paths can serialize identically. E.g.,
+web+demo:'s path is the empty string, whereas
+web+demo://host's path is « », and both serialize to the empty string.
+
To determine whether a URL path A +starts with URL path +B, run these steps. They return a boolean. + +
If A is a URL path segment or B is a + URL path segment, then return false. + +
If B's size is greater than A's + size, then return false. + +
For each index of B's indices: if + A[index] is not B[index], then return false. + +
Return true. +
As URL path segments in a list never contain U+002F (/),
+A starts with B only when B covers whole segments of A.
+This makes it suitable for deciding whether one URL path is "contained" by another.
+Comparing serializations cannot be done naïvely: the serialization
+of « "foobar" » starts with the serialization of
+« "foo" », but a URL with the latter path does not
+contain a URL with the former.
+
+
Specifications should prefer the origin concept for security +decisions. Treating a URL path as covering the URL paths it contains is a +form of path-based authority that is discordant with the rest of the web platform. It is needed for +legacy features, such as cookies, and is best avoided elsewhere. +