aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTill Hoeppner2015-05-12 17:17:04 +0200
committerTill Hoeppner2015-05-12 17:17:04 +0200
commitbcc686c84cbcae831aeacc3c9e17b8eaf495353a (patch)
tree1a79d8c7de551f088e8e7cd4e5cf419e1c367e62 /src
parent3e1000e7c20e7e76089a0780b5dad0ecb6b6b158 (diff)
downloadsersve-bcc686c84cbcae831aeacc3c9e17b8eaf495353a.tar.gz
sersve-bcc686c84cbcae831aeacc3c9e17b8eaf495353a.tar.xz
sersve-bcc686c84cbcae831aeacc3c9e17b8eaf495353a.zip
Fix for hyperium/hyper#368
Diffstat (limited to 'src')
-rw-r--r--src/sersve.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sersve.rs b/src/sersve.rs
index dc5f717..1ed1129 100644
--- a/src/sersve.rs
+++ b/src/sersve.rs
@@ -236,6 +236,8 @@ fn from_path(path: &Path) -> IronResult<Response> {
}
fn serve(req: &mut Request) -> IronResult<Response> {
+ req.headers.set_raw("Connection", vec![b"close".to_vec()]);
+
let (filter_str, max_size) = (
ARGS.flag_filter.clone(),
ARGS.flag_size
@@ -277,7 +279,7 @@ fn serve(req: &mut Request) -> IronResult<Response> {
} else {
let mut content: Vec<PathBuf> = match fs::read_dir(&path) {
Ok(s) => s.filter_map(Result::ok).map(|s| s.path()).collect(),
- Err(e) => return html(e.description().as_bytes())
+ Err(e) => return html(format!("Error: {}", e.description()).as_bytes())
};
content.sort_by(|a, b| a.to_string_lossy().cmp(&b.to_string_lossy()));
let mut out = Vec::with_capacity(DEF_LEN);