Comparison

net/http/files.lua @ 13872:76582d10bc09 default tip

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 05 May 2025 17:30:06 +0200
parent 13868:14b52f217f7a
comparison
equal deleted inserted replaced
13866:7f6916088278 13872:76582d10bc09
88 if etag == if_none_match 88 if etag == if_none_match
89 or (not if_none_match and last_modified == if_modified_since) then 89 or (not if_none_match and last_modified == if_modified_since) then
90 return 304; 90 return 304;
91 end 91 end
92 92
93 local data = cache:get(orig_path); 93 local data;
94 if data and data.etag == etag then 94 local cached = cache:get(orig_path);
95 response_headers.content_type = data.content_type; 95 if cached and cached.etag == etag then
96 data = data.data; 96 response_headers.content_type = cached.content_type;
97 cache:set(orig_path, data); 97 data = cached.data;
98 cache:set(orig_path, cached);
98 elseif attr.mode == "directory" and path then 99 elseif attr.mode == "directory" and path then
99 if full_path:sub(-1) ~= "/" then 100 if full_path:sub(-1) ~= "/" then
100 local dir_path = { is_absolute = true, is_directory = true }; 101 local dir_path = { is_absolute = true, is_directory = true };
101 for dir in orig_path:gmatch("[^/]+") do dir_path[#dir_path+1]=dir; end 102 for dir in orig_path:gmatch("[^/]+") do dir_path[#dir_path+1]=dir; end
102 response_headers.location = build_path(dir_path); 103 response_headers.location = build_path(dir_path);