Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tilpner committed May 12, 2015
1 parent 3e1000e commit bcc686c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sersve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bcc686c

Please sign in to comment.