fn check_sni(gs: &Arc<GlobalState>, ssl: &mut ssl::SslRef) -> Result<(), ssl::SniError> {
        let timer = utils::Timer::start();

        // obtain the hostname from the ping_info in backend
        let info = gs.backend.ping_info.load();
        let client_hostname = Option::as_ref(&info).and_then(|x| x.client_url.host_str());

        // verify the servername equals "localhost" or the provided url from backend
        let retval = match (ssl.servername(ssl::NameType::HOST_NAME), client_hostname) {
            (Some("localhost" | "scalpel"), _) => Ok(()),
            (Some(servername), Some(client_servername)) => {
                if servername == client_servername {
                    Ok(())
                } else {
                    Err(ssl::SniError::ALERT_FATAL)
                }
            }
            _ => Err(ssl::SniError::ALERT_FATAL),
        };
        log::debug!(
            "sni verification performed in {} with result {:?}",
            timer,
            retval
        );
        retval
    }
/// Checks the name provided by the client to make sure it matches either "localhost" or `client_url`.
///
/// If this fails, it will return a fatal error which will immediately terminate the SSL connection.
Checks the name provided by the client to make sure it matches either "localhost" or `client_url`.
If this fails, it will return a fatal error which will immediately terminate the SSL connection.
Checks the name provided by the client to make sure it matches either " localhost " or ` client_url ` . If this fails it will return a fatal error which will immediately terminate the SSL connection .
fn check_sni(gs: &Arc<GlobalState>, ssl: &mut ssl::SslRef) -> Result<(), ssl::SniError> {
        let timer = utils::Timer::start();
        // obtain the hostname from the ping_info in backend
        let info = gs.backend.ping_info.load();
        let client_hostname = Option::as_ref(&info).and_then(|x| x.client_url.host_str());
        // verify the servername equals "localhost" or the provided url from backend
        let retval = match (ssl.servername(ssl::NameType::HOST_NAME), client_hostname) {
            (Some("localhost" | "scalpel"), _) => Ok(()),
            (Some(servername), Some(client_servername)) => {
                if servername == client_servername {
                    Ok(())
                } else {
                    Err(ssl::SniError::ALERT_FATAL)
                }
            }
            _ => Err(ssl::SniError::ALERT_FATAL),
        };
        log::debug!(
            "sni verification performed in {} with result {:?}",
            timer,
            retval
        );
        retval
    }
fn check_sni ( gs : & Arc < GlobalState > , ssl : & mut ssl :: SslRef ) -> Result < ( ) , ssl :: SniError > { let timer = utils :: Timer :: start ( ) ; // obtain the hostname from the ping_info in backend let info = gs . backend . ping_info . load ( ) ; let client_hostname = Option :: as_ref ( & info ) . and_then ( | x | x . client_url . host_str ( ) ) ; // verify the servername equals "localhost" or the provided url from backend let retval = match ( ssl . servername ( ssl :: NameType :: HOST_NAME ) , client_hostname ) { ( Some ( " " | " " ) , _ ) => Ok ( ( ) ) , ( Some ( servername ) , Some ( client_servername ) ) => { if servername == client_servername { Ok ( ( ) ) } else { Err ( ssl :: SniError :: ALERT_FATAL ) } } _ => Err ( ssl :: SniError :: ALERT_FATAL ) , } ; log :: debug ! ( " " timer retval ) ; retval }
Checks the name provided by the client to make sure it matches either "localhost" or `client_url`.
Checks the name provided by the client to make sure it matches either " localhost " or ` client_url ` .
gs
&Arc<GlobalState>
ssl
&mut ssl::SslRef