aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-16 08:37:14 +0100
committerKim Alvefur <zash@zash.se>2012-12-16 08:37:14 +0100
commitde3f37a1891f6ad019af14b3dce26b621ccfd9c1 (patch)
treec604c2a76b0d571da3c39a2b8505ca1a538f4f3a /plugins
parentc8ab15002f6c97e991198b72dcc1eb3f814f5536 (diff)
parentcf3f554dbc9cba6b90f60e9334f581d602e0d4df (diff)
downloadprosody-de3f37a1891f6ad019af14b3dce26b621ccfd9c1.tar.gz
prosody-de3f37a1891f6ad019af14b3dce26b621ccfd9c1.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_http_files.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua
index 764991b8..d83e6f97 100644
--- a/plugins/mod_http_files.lua
+++ b/plugins/mod_http_files.lua
@@ -57,11 +57,14 @@ function serve_file(event, path)
return 404;
end
- response.headers.last_modified = os_date('!%a, %d %b %Y %H:%M:%S GMT', attr.modification);
+ local last_modified = os_date('!%a, %d %b %Y %H:%M:%S GMT', attr.modification);
+ response.headers.last_modified = last_modified;
- 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;
- if tag == request.headers.if_none_match then
+ local etag = ("%02x-%x-%x-%x"):format(attr.dev or 0, attr.ino or 0, attr.size or 0, attr.modification or 0);
+ response.headers.etag = etag;
+
+ if etag == request.headers.if_none_match
+ or last_modified == request.headers.if_modified_since then
return 304;
end
@@ -98,7 +101,7 @@ function serve_file(event, path)
end
end
data = "<!DOCTYPE html>\n"..tostring(html);
- cache[path] = { data = html, content_type = mime_map.html; hits = 0 };
+ cache[path] = { data = data, content_type = mime_map.html; hits = 0 };
response.headers.content_type = mime_map.html;
end