Mercurial > prosody-hg
comparison plugins/mod_http_files.lua @ 6887:da38775bda82
Merge 0.9->0.10
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 27 Sep 2015 00:36:34 +0200 |
| parents | 8796aa94c4b5 6dae43341b44 |
| children | eda0feeaf759 |
comparison
equal
deleted
inserted
replaced
| 6886:27f5a76e3fa5 | 6887:da38775bda82 |
|---|---|
| 59 local dir_indices = opts.index_files or dir_indices; | 59 local dir_indices = opts.index_files or dir_indices; |
| 60 local directory_index = opts.directory_index; | 60 local directory_index = opts.directory_index; |
| 61 local function serve_file(event, path) | 61 local function serve_file(event, path) |
| 62 local request, response = event.request, event.response; | 62 local request, response = event.request, event.response; |
| 63 local orig_path = request.path; | 63 local orig_path = request.path; |
| 64 local full_path = base_path .. (path and "/"..path or ""); | 64 local full_path = base_path .. (path and "/"..path or ""):gsub("/", path_sep); |
| 65 local attr = stat((full_path:gsub('%'..path_sep..'+$',''))); | 65 local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows |
| 66 if not attr then | 66 if not attr then |
| 67 return 404; | 67 return 404; |
| 68 end | 68 end |
| 69 | 69 |
| 70 local request_headers, response_headers = request.headers, response.headers; | 70 local request_headers, response_headers = request.headers, response.headers; |
