aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http_files.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-21 08:25:09 +0100
committerKim Alvefur <zash@zash.se>2012-12-21 08:25:09 +0100
commitf098458b690ecc4b71ec604f81acf8191f0990f8 (patch)
tree5034ac7c970c5b60c94cd77b7e5b1e5ba0f5af0e /plugins/mod_http_files.lua
parent0ff07edb453e5afd98e7236ed467034bf9fb4e33 (diff)
downloadprosody-f098458b690ecc4b71ec604f81acf8191f0990f8.tar.gz
prosody-f098458b690ecc4b71ec604f81acf8191f0990f8.zip
mod_http_files: Only serve cached data if etag is unchanged.
Diffstat (limited to 'plugins/mod_http_files.lua')
-rw-r--r--plugins/mod_http_files.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua
index 70ef5623..dea209c8 100644
--- a/plugins/mod_http_files.lua
+++ b/plugins/mod_http_files.lua
@@ -73,7 +73,7 @@ function serve_file(event, path)
end
local data = cache[path];
- if data then
+ if data and data.etag == etag then
response_headers.content_type = data.content_type;
data = data.data;
elseif attr.mode == "directory" then
@@ -105,7 +105,7 @@ function serve_file(event, path)
end
end
data = "<!DOCTYPE html>\n"..tostring(html);
- cache[path] = { data = data, content_type = mime_map.html; hits = 0 };
+ cache[path] = { data = data, content_type = mime_map.html; etag = etag; };
response_headers.content_type = mime_map.html;
end
@@ -120,7 +120,7 @@ function serve_file(event, path)
end
local ext = path:match("%.([^./]+)$");
local content_type = ext and mime_map[ext];
- cache[path] = { data = data; content_type = content_type; };
+ cache[path] = { data = data; content_type = content_type; etag = etag };
response_headers.content_type = content_type;
end