mod_http_files: Add Last-Modified header
authorKim Alvefur <zash@zash.se>
Tue, 11 Dec 2012 22:30:50 +0100
changeset 5235 e0373e0dd048
parent 5234 a9f0a1becc66
child 5236 8d116a0cdacd
mod_http_files: Add Last-Modified header
plugins/mod_http_files.lua
--- a/plugins/mod_http_files.lua	Tue Dec 11 22:30:13 2012 +0100
+++ b/plugins/mod_http_files.lua	Tue Dec 11 22:30:50 2012 +0100
@@ -9,6 +9,7 @@
 module:depends("http");
 local lfs = require "lfs";
 
+local os_date = os.date;
 local open = io.open;
 local stat = lfs.attributes;
 
@@ -35,6 +36,7 @@
 		return 404;
 	end
 
+	response.headers.last_modified = os_date('!%a, %d %b %Y %H:%M:%S GMT', attr.modification);
 
 	local tag = ("%02x-%x-%x-%x"):format(attr.dev or 0, attr.ino or 0, attr.size or 0, attr.modification or 0);
 	response.headers.etag = tag;