aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-14 14:31:59 +0200
committerKim Alvefur <zash@zash.se>2018-10-14 14:31:59 +0200
commit0247a0e9049be42a0420a991feb9b9e9c7800bc0 (patch)
tree34780f34fa2362994aec9153e0ed7db7c1feda7b /plugins/mod_http.lua
parent29c9d1f50885e0c6aab08b7ddf4fe1eda08c05cc (diff)
downloadprosody-0247a0e9049be42a0420a991feb9b9e9c7800bc0.tar.gz
prosody-0247a0e9049be42a0420a991feb9b9e9c7800bc0.zip
mod_http: Move normalize_path to util.http
Diffstat (limited to 'plugins/mod_http.lua')
-rw-r--r--plugins/mod_http.lua11
1 files changed, 1 insertions, 10 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index 19f1e2fa..a1d409bd 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -13,6 +13,7 @@ local portmanager = require "core.portmanager";
local moduleapi = require "core.moduleapi";
local url_parse = require "socket.url".parse;
local url_build = require "socket.url".build;
+local normalize_path = require "util.http".normalize_path;
local server = require "net.http.server";
@@ -21,16 +22,6 @@ server.set_default_host(module:get_option_string("http_default_host"));
server.set_option("body_size_limit", module:get_option_number("http_max_content_size"));
server.set_option("buffer_size_limit", module:get_option_number("http_max_buffer_size"));
-local function normalize_path(path, is_dir)
- if is_dir then
- if path:sub(-1,-1) ~= "/" then path = path.."/"; end
- else
- if path:sub(-1,-1) == "/" then path = path:sub(1, -2); end
- end
- if path:sub(1,1) ~= "/" then path = "/"..path; end
- return path;
-end
-
local function get_http_event(host, app_path, key)
local method, path = key:match("^(%S+)%s+(.+)$");
if not method then -- No path specified, default to "" (base path)