Skip to main content

parse_x_forwarded_proto

Function parse_x_forwarded_proto 

Source
pub fn parse_x_forwarded_proto(value: &[u8]) -> Result<Proto, ParseError>
Expand description

Parses X-Forwarded-Proto: a URI scheme, case-insensitive (Proto names http, https, ws, and wss); a comma list only when every member is the same.

§Errors

ErrorKind::Malformed.

§Examples

use parse_net::forwarded::{parse_x_forwarded_proto, Proto};

assert_eq!(parse_x_forwarded_proto(b"HTTPS")?, Proto::Https);
assert!(parse_x_forwarded_proto(b"https, http").is_err());