Skip to main content

parse_origin_form

Function parse_origin_form 

Source
pub fn parse_origin_form(
    input: &[u8],
    merge_slashes: bool,
) -> Result<Parsed<'_>, ParseError>
Expand description

Parse a single origin-form request target exactly as nginx does.

The returned values correspond to the initial values nginx exposes through its $uri and $args variables. nginx may subsequently change these variables during request processing.

  • 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.