/// Check if a given service is an HTTP service.
Check if a given service is an HTTP service.
Check if a given service is an HTTP service .
fn is_http_service(addr: SocketAddr) -> Result<bool> {
    let host = format!("{}", addr.ip());
    let port = addr.port();
    // treat connection errors as error responses
    if let Ok(mut client) = HttpClient::new(&host, port) {
        try!(client.set_timeout(Some(1000)));
        let response = client.get_header("/");
        Ok(response.is_ok())
    } else {
        Ok(false)
    }
}
fn is_http_service ( addr : SocketAddr ) -> Result < bool > { let host = format ! ( " " addr ip ( ) ) ; let port = addr . port ( ) ; // treat connection errors as error responses if let Ok ( mut client ) = HttpClient :: new ( & host , port ) { try ! ( client set_timeout ( Some ( 1000 ) ) ) ; let response = client . get_header ( " " ) ; Ok ( response . is_ok ( ) ) } else { Ok ( false ) } }
Check if a given service is an HTTP service.
Check if a given service is an HTTP service .
addr
SocketAddr