diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-14 14:19:21 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-14 14:19:21 +0200 |
commit | a14a75fb1800dd94c8240ceb02a769e7e67f3628 (patch) | |
tree | a23bf30a53b66556bed5c3a232ce1a6bd2b2bb10 /plugins/mod_http.lua | |
parent | b509a1b16fce31139d0cabb5ee4cb1361d8700cb (diff) | |
parent | 2e93c4b785f8648381a3f91937bb84c12f14d6ba (diff) | |
download | prosody-a14a75fb1800dd94c8240ceb02a769e7e67f3628.tar.gz prosody-a14a75fb1800dd94c8240ceb02a769e7e67f3628.zip |
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_http.lua')
-rw-r--r-- | plugins/mod_http.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 0eef6d63..19f1e2fa 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -21,8 +21,12 @@ 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) - if path:sub(-1,-1) == "/" then path = path:sub(1, -2); end +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 @@ -77,7 +81,7 @@ function moduleapi.http_url(module, app_name, default_path) scheme = (external_url.scheme or service[1].service.name); host = (external_url.host or module:get_option_string("http_host", module.host)); port = tonumber(external_url.port) or port or 80; - path = normalize_path(external_url.path or "/").. + path = normalize_path(external_url.path or "/", true).. (get_base_path(module, app_name, default_path or "/"..app_name):sub(2)); } if ports_by_scheme[url.scheme] == url.port then url.port = nil end |