Skip to main content

Module path

Module path 

Source
Expand description

Percent-decoding and canonicalisation for URL path segments. Percent-decoding for URL path segments.

Deliberately separate from the query-string decoder in crate::call. Two differences matter, and both are defects if carried over:

  • + is a literal plus in a path. Only application/x-www-form-urlencoded query strings treat it as a space.
  • Invalid UTF-8 is an error, not U+FFFD. Replacement characters collapse distinct byte sequences into the same string, which is unsound input to a path-safety decision.

Callers must split on / before decoding. Decoding first would let %2F manufacture separators and forge extra path segments.

Enums§

PathPolicy
What to do when a request path is a non-canonical spelling of a route.

Functions§

canonical_path
The canonical spelling of path, or None if it is already canonical.