latest revised test

This commit is contained in:
bunnie 2022-03-18 20:28:36 +08:00
parent 4463b909a1
commit 140f07ddc8

View file

@ -73,10 +73,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
if let Some(url) = tokens.next() {
match url.split_once('/') {
Some((host, path)) => {
match self.dns.lookup(host) {
Ok(ipaddr) => {
log::info!("resolved {} to {:?}", host, ipaddr);
match TcpStream::connect((IpAddr::from(ipaddr), 80)) {
match TcpStream::connect((host, 80)) {
Ok(mut stream) => {
log::trace!("stream open, setting timeouts");
stream.set_read_timeout(Some(std::time::Duration::from_millis(10_000))).unwrap();
@ -109,9 +106,6 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
Err(e) => write!(ret, "Couldn't connect to {}:80: {:?}", host, e).unwrap(),
}
}
_ => write!(ret, "Couldn't resolve {}", host).unwrap(),
}
}
_ => write!(ret, "Usage: tcpget bunniefoo.com/bunnie/test.txt").unwrap(),
}
} else {