Mercurial > prosody-hg
comparison net/http/files.lua @ 10065:b399dca1273c
net.http.files: Fix cache handling
Typo that broke the LRU-ness of the caching
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 29 Jun 2019 19:19:38 +0200 |
| parents | 5c71693c8345 |
| children | 34f7a0e8fa59 |
comparison
equal
deleted
inserted
replaced
| 10064:1acfd25cd507 | 10065:b399dca1273c |
|---|---|
| 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 cache:set(orig_path, data); |
| 98 elseif attr.mode == "directory" and path then | 98 elseif attr.mode == "directory" and path then |
| 99 if full_path:sub(-1) ~= "/" then | 99 if full_path:sub(-1) ~= "/" then |
| 100 local dir_path = { is_absolute = true, is_directory = true }; | 100 local dir_path = { is_absolute = true, is_directory = true }; |
| 101 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 |
| 102 response_headers.location = build_path(dir_path); | 102 response_headers.location = build_path(dir_path); |
