actix-web
actix-web copied to clipboard
Actix Files does not serve files with a modification date before UNIX epoch
Expected Behavior
I was working with archive video footage that has its modification date set to the date it was shot. In my case a video from 1964. I expected this video to be served without any issues.
Current Behavior
A panic with this message:
thread 'actix-rt|system:0|arbiter:0' panicked at 'modification time must be after epoch: SystemTimeError(189347400s)', /cargo/registry/src/github.com-1ecc6299db9ec823/actix-files-0.6.0/src/named.rs:360:18
Steps to Reproduce (for bugs)
- Set the modification date of the file to a date before 1970. E.g.:
# Sets the file's modification date to 12th of February, 1964.
touch -t 196402121230 <file>
- Try to access that file through Actix Files as a named file.
Your Environment
actix-web = { version = "4.0", features = ["rustls"] }
actix-rt = "2.7"
actix-cors = "0.6"
actix-files = "0.6"
rustc 1.60.0 (7737e0b5c 2022-04-04)
Running in production on Ubuntu Linux (5.4.0-107-generic).
I have been testing with a change (https://github.com/marknijboer/actix-web/commit/19608e743053b79ad40c2fde7a27eedff719beb5) that allows pre-epoch modification times for NamedFiles. This makes the generation of etags possible, but unfortunately a new issue pops up in an external crate httpdate
:
panicked at 'all times should be after the epoch: SystemTimeError(189347400s)', /registry/src/github.com-1ecc6299db9ec823/httpdate-1.0.2/src/date.rs:51:14
This error occurs in fn last_modified(&self) -> Option<header::HttpDate>
, where a SystemTime is being converted to a HttpDate that does not support pre-epoch times :-(
I have encountered this issue as well https://github.com/svenstaro/miniserve/issues/1288