Software /
code /
prosody
Comparison
plugins/mod_http.lua @ 11066:dc41c8dfd2b1
mod_http: Silence warnings when running under prosodyctl
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 11 Sep 2020 12:37:07 +0100 |
parent | 11022:3e5bc34be734 |
child | 11382:a0477656258c |
comparison
equal
deleted
inserted
replaced
11065:95eb1a981ef6 | 11066:dc41c8dfd2b1 |
---|---|
91 } | 91 } |
92 if ports_by_scheme[url.scheme] == url.port then url.port = nil end | 92 if ports_by_scheme[url.scheme] == url.port then url.port = nil end |
93 return url_build(url); | 93 return url_build(url); |
94 end | 94 end |
95 end | 95 end |
96 module:log("warn", "No http ports enabled, can't generate an external URL"); | 96 if prosody.process_type == "prosody" then |
97 module:log("warn", "No http ports enabled, can't generate an external URL"); | |
98 end | |
97 return "http://disabled.invalid/"; | 99 return "http://disabled.invalid/"; |
98 end | 100 end |
99 | 101 |
100 local function apply_cors_headers(response, methods, headers, max_age, allow_credentials, origin) | 102 local function apply_cors_headers(response, methods, headers, max_age, allow_credentials, origin) |
101 response.headers.access_control_allow_methods = tostring(methods); | 103 response.headers.access_control_allow_methods = tostring(methods); |
188 end | 190 end |
189 end | 191 end |
190 local services = portmanager.get_active_services(); | 192 local services = portmanager.get_active_services(); |
191 if services:get("https") or services:get("http") then | 193 if services:get("https") or services:get("http") then |
192 module:log("info", "Serving '%s' at %s", app_name, module:http_url(app_name, app_path)); | 194 module:log("info", "Serving '%s' at %s", app_name, module:http_url(app_name, app_path)); |
193 else | 195 elseif prosody.process_type == "prosody" then |
194 module:log("warn", "Not listening on any ports, '%s' will be unreachable", app_name); | 196 module:log("warn", "Not listening on any ports, '%s' will be unreachable", app_name); |
195 end | 197 end |
196 end | 198 end |
197 | 199 |
198 local function http_app_removed(event) | 200 local function http_app_removed(event) |