From 91235ac81631958a1a03d4e39ae90af07d05bf9d Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 29 Apr 2018 20:34:59 -0700 Subject: [PATCH] fix reading from socket --- src/fs.rs | 2 +- src/server/h1.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; } } }