diff options
author | Sergey Rublev <[email protected]> | 2013-06-07 21:44:58 +0700 |
---|---|---|
committer | Sergey Rublev <[email protected]> | 2013-06-07 22:21:42 +0700 |
commit | d6c9bb27ad352c1a8da79e5dc6dcf11a71d86a38 (patch) | |
tree | 056b4adccdc2922a91476d59e1e3c83cc6fb3759 | |
parent | 1fc69977da8f57d5d3fa48cd68280aa2c0b1d78b (diff) | |
download | cowboy-d6c9bb27ad352c1a8da79e5dc6dcf11a71d86a38.tar.gz cowboy-d6c9bb27ad352c1a8da79e5dc6dcf11a71d86a38.tar.bz2 cowboy-d6c9bb27ad352c1a8da79e5dc6dcf11a71d86a38.zip |
Use read_file_info/2 with {time, universal} option
-rw-r--r-- | src/cowboy_static.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl index fd5654e..d144dd3 100644 --- a/src/cowboy_static.erl +++ b/src/cowboy_static.erl @@ -233,7 +233,7 @@ rest_init(Req, Opts) -> end. rest_init(Req, Opts, Filepath) -> - Fileinfo = file:read_file_info(Filepath), + Fileinfo = file:read_file_info(Filepath, [{time, universal}]), Mimetypes = case lists:keyfind(mimetypes, 1, Opts) of false -> {fun path_to_mimetypes/2, []}; {_, {{M, F}, E}} -> {fun M:F/2, E}; @@ -290,7 +290,7 @@ forbidden(Req, #state{fileinfo={ok, #file_info{access=Access}}}=State) -> -spec last_modified(Req, #state{}) -> {calendar:datetime(), Req, #state{}} when Req::cowboy_req:req(). last_modified(Req, #state{fileinfo={ok, #file_info{mtime=Modified}}}=State) -> - {erlang:localtime_to_universaltime(Modified), Req, State}. + {Modified, Req, State}. %% @private Generate the ETag header value for this file. %% The ETag header value is only generated if the resource is a file that |