pub fn parse_origin_form(
target: &[u8],
merge_slashes: bool,
) -> Result<Parsed<'_>, ParseError>Expand description
Parse a single origin-form request target exactly as nginx does.
An origin-form target is the absolute path and optional query string that a
client puts on the request line, for example /docs/../hello%20world?x=1
(see RFC 9112 §3.2.1).
The return value consists of path and args, which correspond to nginx’s
$uri and $args respectively.
Ok(Parsed)— the normalized path and query string. For a “simple” path that needs no normalization, the path borrows the input unchanged (Cow::Borrowed) with no allocation; normalization returns an owned buffer (Cow::Owned). The query string always borrows the input.Err(ParseError)— the request target could not be parsed.
merge_slashes corresponds to nginx’s merge_slashes
directive: true is on (the nginx default), and false is off.