diff --git a/src/fs.rs b/src/fs.rs index 0a526d578..2aa1b979e 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -573,7 +573,7 @@ impl Handler for StaticFiles { } else { let relpath = match req.match_info() .get("tail") - .map(|tail| PathBuf::from_param(tail)) + .map(|tail| PathBuf::from_param(tail.trim_left_matches('/'))) { Some(Ok(path)) => path, _ => return Ok(self.default.handle(req)), diff --git a/src/server/h1.rs b/src/server/h1.rs index 5f70bd0dc..8c793ed50 100644 --- a/src/server/h1.rs +++ b/src/server/h1.rs @@ -388,7 +388,7 @@ where } } Err(e) => { - return e.kind() == io::ErrorKind::WouldBlock; + return e.kind() != io::ErrorKind::WouldBlock; } } }