mirror of
https://github.com/fafhrd91/actix-web
synced 2024-12-18 01:43:58 +01:00
fix NamedFile last-modified check #820
This commit is contained in:
parent
d3e807f6e9
commit
babf48c550
@ -1,5 +1,10 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## [0.1.0] - 2019-05-xx
|
||||||
|
|
||||||
|
* NamedFile last-modified check always fails due to nano-seconds
|
||||||
|
in file modified date #820
|
||||||
|
|
||||||
## [0.1.0-beta.4] - 2019-05-12
|
## [0.1.0-beta.4] - 2019-05-12
|
||||||
|
|
||||||
* Update actix-web to beta.4
|
* Update actix-web to beta.4
|
||||||
|
@ -337,7 +337,12 @@ impl Responder for NamedFile {
|
|||||||
} else if let (Some(ref m), Some(header::IfUnmodifiedSince(ref since))) =
|
} else if let (Some(ref m), Some(header::IfUnmodifiedSince(ref since))) =
|
||||||
(last_modified, req.get_header())
|
(last_modified, req.get_header())
|
||||||
{
|
{
|
||||||
m > since
|
let t1: SystemTime = m.clone().into();
|
||||||
|
let t2: SystemTime = since.clone().into();
|
||||||
|
match (t1.duration_since(UNIX_EPOCH), t2.duration_since(UNIX_EPOCH)) {
|
||||||
|
(Ok(t1), Ok(t2)) => t1 > t2,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
@ -350,7 +355,12 @@ impl Responder for NamedFile {
|
|||||||
} else if let (Some(ref m), Some(header::IfModifiedSince(ref since))) =
|
} else if let (Some(ref m), Some(header::IfModifiedSince(ref since))) =
|
||||||
(last_modified, req.get_header())
|
(last_modified, req.get_header())
|
||||||
{
|
{
|
||||||
m <= since
|
let t1: SystemTime = m.clone().into();
|
||||||
|
let t2: SystemTime = since.clone().into();
|
||||||
|
match (t1.duration_since(UNIX_EPOCH), t2.duration_since(UNIX_EPOCH)) {
|
||||||
|
(Ok(t1), Ok(t2)) => t1 <= t2,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user