Skip to main content

validate_upgrade

Function validate_upgrade 

Source
pub fn validate_upgrade(head: &RequestHead) -> Result<String, UpgradeRejection>
Expand description

Check a parsed request against RFC 6455 §4.2.1 and return the client’s Sec-WebSocket-Key when it is a valid upgrade.

This is pure mechanics with no decision in it, so it never reaches the model — a request that is not a WebSocket handshake at all is answered with an HTTP error directly.