Mercurial > prosody-hg
comparison net/http/files.lua @ 12974:ba409c67353b
net: Prefix module imports with prosody namespace
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 17 Mar 2023 16:23:12 +0100 |
| parents | 36942fa001b4 |
| children | dba7073f1452 |
comparison
equal
deleted
inserted
replaced
| 12973:cc215923297f | 12974:ba409c67353b |
|---|---|
| 4 -- | 4 -- |
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 local server = require"net.http.server"; | 9 local server = require"prosody.net.http.server"; |
| 10 local lfs = require "lfs"; | 10 local lfs = require "lfs"; |
| 11 local new_cache = require "util.cache".new; | 11 local new_cache = require "prosody.util.cache".new; |
| 12 local log = require "util.logger".init("net.http.files"); | 12 local log = require "prosody.util.logger".init("net.http.files"); |
| 13 | 13 |
| 14 local os_date = os.date; | 14 local os_date = os.date; |
| 15 local open = io.open; | 15 local open = io.open; |
| 16 local stat = lfs.attributes; | 16 local stat = lfs.attributes; |
| 17 local build_path = require"socket.url".build_path; | 17 local build_path = require"socket.url".build_path; |
| 21 local forbidden_chars_pattern = "[/%z]"; | 21 local forbidden_chars_pattern = "[/%z]"; |
| 22 if package.config:sub(1,1) == "\\" then | 22 if package.config:sub(1,1) == "\\" then |
| 23 forbidden_chars_pattern = "[/%z\001-\031\127\"*:<>?|]" | 23 forbidden_chars_pattern = "[/%z\001-\031\127\"*:<>?|]" |
| 24 end | 24 end |
| 25 | 25 |
| 26 local urldecode = require "util.http".urldecode; | 26 local urldecode = require "prosody.util.http".urldecode; |
| 27 local function sanitize_path(path) --> util.paths or util.http? | 27 local function sanitize_path(path) --> util.paths or util.http? |
| 28 if not path then return end | 28 if not path then return end |
| 29 local out = {}; | 29 local out = {}; |
| 30 | 30 |
| 31 local c = 0; | 31 local c = 0; |
