Skip to main content

Module handshake

Module handshake 

Available on crate features http and std only.
Expand description

Upgrade-token handshakes for protocols that use the Capsule Protocol (RFC 9297 §3.2).

HTTP/1.1 upgrades with Upgrade + Connection: upgrade and succeeds with 101; HTTP/2 and HTTP/3 use Extended CONNECT (RFC 8441, RFC 9220) and succeed with any 2xx. HTTP/1.0 cannot upgrade (RFC 9110 §7.8). These helpers keep that version mapping in one place.

Received messages are checked under a ViolationPolicy. Reject treats every field RFC 9297 §3.2 forbids as malformed. Ignore only rejects fields that would frame request content ahead of the capsules (a non-zero Content-Length, any Transfer-Encoding); on a 101 or a 2xx CONNECT response they never frame the tunnel and are left alone.

Enums§

CapsuleHandshakeError
A handshake that cannot start or accept the Capsule Protocol.

Functions§

capsule_response
Build the response accepting a Capsule Protocol handshake for protocol on version.
capsule_response_status
The status accepting a Capsule Protocol handshake on version.
prepare_capsule_request
Turn request into a Capsule Protocol handshake for protocol on its HTTP version, advertising Capsule-Protocol: ?1. The request must not carry content.
validate_capsule_request
Validate a received Capsule Protocol handshake request and return its upgrade token.
validate_capsule_response
Validate the response to a Capsule Protocol handshake for protocol sent on version.