refactored cli and logging
All checks were successful
Test the running changes / Test (push) Successful in 41s

This commit is contained in:
2025-11-21 01:37:19 +02:00
parent f68b1bb276
commit 1aa6af3b1a
10 changed files with 259 additions and 123 deletions

View File

@@ -29,7 +29,7 @@ mod response;
///
/// # Panics
/// Never. Added to allow compiler to check for ! type.
pub fn serve(addr: Ipv4Addr, port: u16, dir: PathBuf) -> Result<!, Error> {
pub fn serve(addr: Ipv4Addr, port: u16, dir: PathBuf) -> Result<(), Error> {
/*
let args: ProgramArgs = std::env::args().try_into()?;
@@ -88,6 +88,5 @@ pub fn serve(addr: Ipv4Addr, port: u16, dir: PathBuf) -> Result<!, Error> {
Err(e) => log!(Level::Warn, "Connection failed: {}", e),
}
}
panic!("Code shouldn't get to here");
Ok(())
}

View File

@@ -110,6 +110,14 @@ impl TryFrom<&mut BufReader<&TcpStream>> for HttpRequest {
}
}
log!(
Level::Info,
"{} /{} {}",
req.method,
req.path.display(),
req.version
);
Ok(req)
}
}