Skip to content

Commit cd29efd

Browse files
committed
Fix timestamps and headers
1 parent 78553d3 commit cd29efd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ impl Handler for Static {
4848
}
4949
let mtime = FileTime::from_last_modification_time(&data);
5050
let ts = time::Timespec {
51-
sec: (mtime.seconds_relative_to_1970() as i64) / 1000,
52-
nsec: (((mtime.nanoseconds() as u32) % 1000) as i32) * 1000000
51+
sec: mtime.seconds_relative_to_1970() as i64,
52+
nsec: mtime.nanoseconds() as i32,
5353
};
5454
let tm = time::at(ts).to_utc();
5555

@@ -70,9 +70,12 @@ impl Handler for Static {
7070
}
7171

7272
fn not_found() -> Response {
73+
let mut headers = HashMap::new();
74+
headers.insert("Content-Length".to_string(), vec!["0".to_string()]);
75+
headers.insert("Content-Type".to_string(), vec!["text/plain".to_string()]);
7376
Response {
7477
status: (404, "Not Found"),
75-
headers: HashMap::new(),
78+
headers: headers,
7679
body: Box::new(io::empty()),
7780
}
7881
}

0 commit comments

Comments
 (0)