/// Checks requests to determine if they want to perform an HTTP upgrade.
Checks requests to determine if they want to perform an HTTP upgrade.
Checks requests to determine if they want to perform an HTTP upgrade .
pub(crate) fn wants_upgrade<B>(req: &http::Request<B>) -> bool {
    // HTTP upgrades were added in 1.1, not 1.0.
    if req.version() != http::Version::HTTP_11 {
        return false;
    }
    if let Some(upgrade) = req.headers().get(UPGRADE) {
        // If an `h2` upgrade over HTTP/1.1 were to go by the proxy,
        // and it succeeded, there would an h2 connection, but it would
        // be opaque-to-the-proxy, acting as just a TCP proxy.
        //
        // A user wouldn't be able to see any usual HTTP telemetry about
        // requests going over that connection. Instead of that confusion,
        // the proxy strips h2 upgrade headers.
        //
        // Eventually, the proxy will support h2 upgrades directly.
        return upgrade != "h2c";
    }
    // HTTP/1.1 CONNECT requests are just like upgrades!
    req.method() == http::Method::CONNECT
}
pub ( crate ) fn wants_upgrade < B > ( req : & http :: Request < B > ) -> bool { // HTTP upgrades were added in 1.1, not 1.0. if req . version ( ) != http :: Version :: HTTP_11 { return false ; } if let Some ( upgrade ) = req . headers ( ) . get ( UPGRADE ) { // If an `h2` upgrade over HTTP/1.1 were to go by the proxy, // and it succeeded, there would an h2 connection, but it would // be opaque-to-the-proxy, acting as just a TCP proxy. // // A user wouldn't be able to see any usual HTTP telemetry about // requests going over that connection. Instead of that confusion, // the proxy strips h2 upgrade headers. // // Eventually, the proxy will support h2 upgrades directly. return upgrade != " " ; } // HTTP/1.1 CONNECT requests are just like upgrades! req . method ( ) == http :: Method :: CONNECT }
Checks requests to determine if they want to perform an HTTP upgrade.
Checks requests to determine if they want to perform an HTTP upgrade .
req
&http::Request<B>