start working on exec subcommand

This commit is contained in:
Joseph Montanaro 2023-05-02 15:36:00 -07:00
parent e8b8dc2976
commit 41f8e8f2ab
2 changed files with 7 additions and 1 deletions

View File

@ -121,7 +121,8 @@ pub enum RequestError {
StreamIOError(#[from] std::io::Error),
// #[error("Received invalid UTF-8 in request")]
// InvalidUtf8,
// MalformedHttpRequest,
#[error("HTTP request malformed")]
BadRequest,
#[error("HTTP request too large")]
RequestTooLarge,
#[error("Error accessing credentials: {0}")]

View File

@ -103,6 +103,11 @@ impl Handler {
println!("{}", std::str::from_utf8(&buf).unwrap());
}
let path = buf.split(|&c| &[c] == b" ")
.skip(1)
.next()
.ok_or(RequestError::BadRequest(buf))?;
Ok(buf)
}