File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
3
3
name = " conduit-static"
4
- version = " 0.7.2 "
4
+ version = " 0.7.3 "
5
5
6
6
" Alex Crichton <[email protected] >" ]
7
7
description = " Middleware for serving static files for conduit"
@@ -12,6 +12,7 @@ license = "MIT"
12
12
conduit = " 0.7"
13
13
conduit-mime-types = " 0.7"
14
14
time = " 0.1"
15
+ filetime = " 0.1"
15
16
16
17
[dev-dependencies ]
17
18
civet = " 0.7"
Original file line number Diff line number Diff line change 1
1
#![ allow( trivial_casts) ]
2
- #![ feature( fs_time) ]
3
2
#![ cfg_attr( test, deny( warnings) ) ]
4
3
5
4
extern crate conduit;
6
5
extern crate conduit_mime_types as mime;
7
6
extern crate time;
7
+ extern crate filetime;
8
8
#[ cfg( test) ] extern crate tempdir;
9
9
10
10
use std:: collections:: HashMap ;
@@ -14,6 +14,7 @@ use std::io::prelude::*;
14
14
use std:: path:: { PathBuf , Path } ;
15
15
use std:: fs:: File ;
16
16
use conduit:: { Request , Response , Handler } ;
17
+ use filetime:: FileTime ;
17
18
18
19
pub struct Static {
19
20
path : PathBuf ,
@@ -46,9 +47,10 @@ impl Handler for Static {
46
47
if data. is_dir ( ) {
47
48
return Ok ( not_found ( ) )
48
49
}
50
+ let mtime = FileTime :: from_last_modification_time ( & data) ;
49
51
let ts = time:: Timespec {
50
- sec : ( data . modified ( ) as i64 ) / 1000 ,
51
- nsec : ( ( ( data . modified ( ) as u32 ) % 1000 ) as i32 ) * 1000000
52
+ sec : ( mtime . seconds_relative_to_1970 ( ) as i64 ) / 1000 ,
53
+ nsec : ( ( ( mtime . nanoseconds ( ) as u32 ) % 1000 ) as i32 ) * 1000000
52
54
} ;
53
55
let tm = time:: at ( ts) . to_utc ( ) ;
54
56
You can’t perform that action at this time.
0 commit comments