pub(crate) fn is_upgrade<B>(res: &http::Response<B>) -> bool {
    // Upgrades were introduced in HTTP/1.1
    if res.version() != http::Version::HTTP_11 {
        return false;
    }

    // 101 Switching Protocols
    if res.status() == http::StatusCode::SWITCHING_PROTOCOLS {
        return true;
    }

    // CONNECT requests are complete if status code is 2xx.
    if res.extensions().get::<HttpConnect>().is_some() && res.status().is_success() {
        return true;
    }

    // Just a regular HTTP response...
    false
}
/// Checks responses to determine if they are successful HTTP upgrades.
Checks responses to determine if they are successful HTTP upgrades.
Checks responses to determine if they are successful HTTP upgrades .
pub(crate) fn is_upgrade<B>(res: &http::Response<B>) -> bool {
    // Upgrades were introduced in HTTP/1.1
    if res.version() != http::Version::HTTP_11 {
        return false;
    }
    // 101 Switching Protocols
    if res.status() == http::StatusCode::SWITCHING_PROTOCOLS {
        return true;
    }
    // CONNECT requests are complete if status code is 2xx.
    if res.extensions().get::<HttpConnect>().is_some() && res.status().is_success() {
        return true;
    }
    // Just a regular HTTP response...
    false
}
pub ( crate ) fn is_upgrade < B > ( res : & http :: Response < B > ) -> bool { // Upgrades were introduced in HTTP/1.1 if res . version ( ) != http :: Version :: HTTP_11 { return false ; } // 101 Switching Protocols if res . status ( ) == http :: StatusCode :: SWITCHING_PROTOCOLS { return true ; } // CONNECT requests are complete if status code is 2xx. if res . extensions ( ) . get :: < HttpConnect > ( ) . is_some ( ) && res . status ( ) . is_success ( ) { return true ; } // Just a regular HTTP response... false }
Checks responses to determine if they are successful HTTP upgrades.
Checks responses to determine if they are successful HTTP upgrades .
res
&http::Response<B>
res
&http::Response<B>