Comparison

net/http/files.lua @ 9996:9bb1bed3e8e3

net.http.files: Bump cache hits so they stay cached It's not an LRU cache unless this is done.
author Kim Alvefur <zash@zash.se>
date Sat, 04 May 2019 04:48:40 +0200
parent 9949:a39f3681d685
child 10061:5c71693c8345
comparison
equal deleted inserted replaced
9995:8d46ecc4bd0c 9996:9bb1bed3e8e3
92 92
93 local data = cache:get(orig_path); 93 local data = cache:get(orig_path);
94 if data and data.etag == etag then 94 if data and data.etag == etag then
95 response_headers.content_type = data.content_type; 95 response_headers.content_type = data.content_type;
96 data = data.data; 96 data = data.data;
97 cache:get(orig_path, data);
97 elseif attr.mode == "directory" and path then 98 elseif attr.mode == "directory" and path then
98 if full_path:sub(-1) ~= "/" then 99 if full_path:sub(-1) ~= "/" then
99 local dir_path = { is_absolute = true, is_directory = true }; 100 local dir_path = { is_absolute = true, is_directory = true };
100 for dir in orig_path:gmatch("[^/]+") do dir_path[#dir_path+1]=dir; end 101 for dir in orig_path:gmatch("[^/]+") do dir_path[#dir_path+1]=dir; end
101 response_headers.location = build_path(dir_path); 102 response_headers.location = build_path(dir_path);