@@ -62,11 +62,26 @@ pub(crate) use informational::OnInformational;
6262#[ cfg( all( feature = "http1" , feature = "client" , feature = "ffi" ) ) ]
6363pub ( crate ) use informational:: { on_informational_raw, OnInformationalCallback } ;
6464
65+
6566#[ cfg( feature = "http2" ) ]
66- /// Represents the `:protocol` pseudo-header used by
67- /// the [Extended CONNECT Protocol].
67+ /// Extension type representing the `:protocol` pseudo-header in HTTP/2.
68+ ///
69+ /// The `Protocol` extension allows access to the value of the `:protocol` pseudo-header
70+ /// used by the [Extended CONNECT Protocol](https://datatracker.ietf.org/doc/html/rfc8441#section-4).
71+ /// This extension is only sent on HTTP/2 CONNECT requests, most commonly with the value `websocket`.
72+ ///
73+ /// # Example
6874///
69- /// [Extended CONNECT Protocol]: https://datatracker.ietf.org/doc/html/rfc8441#section-4
75+ /// ```rust
76+ /// use hyper::ext::Protocol;
77+ /// use http::{Request, Method, Version};
78+ ///
79+ /// let mut req = Request::new(());
80+ /// *req.method_mut() = Method::CONNECT;
81+ /// *req.version_mut() = Version::HTTP_2;
82+ /// req.extensions_mut().insert(Protocol::from_static("websocket"));
83+ /// // Now the request will include the `:protocol` pseudo-header with value "websocket"
84+ /// ```
7085#[ derive( Clone , Eq , PartialEq ) ]
7186pub struct Protocol {
7287 inner : h2:: ext:: Protocol ,
0 commit comments