pub enum Method {
Connect,
Other(Box<str>),
}Expand description
A request method (RFC 9110 §9).
CONNECT is the only method this proxy serves, and it is a variant of its own so that asking whether a request is one is a tag comparison rather than a string compare. Every other method still has to be representable: a method this server does not implement is answered with 501 (RFC 9110 §15.6.2), which it cannot be if the token never survived parsing.
Variants§
Connect
CONNECT (RFC 9110 §9.3.6), which for this server means a tunnel.
Other(Box<str>)
Any other method. The payload is the token as it arrived.
Implementations§
Source§impl Method
impl Method
Sourcepub fn parse(bytes: &[u8]) -> Option<Self>
pub fn parse(bytes: &[u8]) -> Option<Self>
Reads a :method value, or None if it is not a token.
RFC 9110 §5.6.2’s token: one or more tchar. A method name is
case-sensitive (RFC 9110 §9.1), so nothing here folds case – connect
is not CONNECT and is answered with a 501 like any other method this
server does not implement.