fn encode_path_segment(s: &str) -> StringExpand description
Percent-encodes s for safe insertion as a single URL path segment.
Byte-wise: any byte outside the RFC 3986 unreserved set (ALPHA /
DIGIT / - / . / _ / ~) becomes %XX (uppercase hex). This is
deliberately stricter than a full path-escaper (it also encodes /),
which is exactly the point here — namespace/package/action are each
meant to occupy exactly one path segment, and a rendered value from
request data (header, query, …) must not be able to smuggle in a /
(segment breakout, e.g. foo/actions/bar) or a ?/& (query-string
injection ahead of the plugin’s own blocking/result/timeout
params). A literal, already-safe value (guest, my_pkg) round-trips
byte-identical since every one of its characters is in unreserved.