Software / code / prosody
Comparison
plugins/mod_admin_telnet.lua @ 7029:b2d160baa957
mod_admin_telnet: Backport 06696882d972 from 0.10 (this command greatly helps with debugging HTTP issues)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 22 Dec 2015 14:15:09 +0000 |
| parent | 6578:6f55db7afd3b |
| child | 7031:89221daefae9 |
| child | 8589:4e475ef4b569 |
comparison
equal
deleted
inserted
replaced
| 7011:2d5751b2f21c | 7029:b2d160baa957 |
|---|---|
| 1079 | 1079 |
| 1080 function def_env.dns:cache() | 1080 function def_env.dns:cache() |
| 1081 return true, "Cache:\n"..tostring(dns.cache()) | 1081 return true, "Cache:\n"..tostring(dns.cache()) |
| 1082 end | 1082 end |
| 1083 | 1083 |
| 1084 def_env.http = {}; | |
| 1085 | |
| 1086 function def_env.http:list() | |
| 1087 local print = self.session.print; | |
| 1088 | |
| 1089 for host in pairs(prosody.hosts) do | |
| 1090 local http_apps = modulemanager.get_items("http-provider", host); | |
| 1091 if #http_apps > 0 then | |
| 1092 local http_host = module:context(host):get_option("http_host"); | |
| 1093 print("HTTP endpoints on "..host..(http_host and (" (using "..http_host.."):") or ":")); | |
| 1094 for _, provider in ipairs(http_apps) do | |
| 1095 local url = module:context(host):http_url(provider.name); | |
| 1096 print("", url); | |
| 1097 end | |
| 1098 print(""); | |
| 1099 end | |
| 1100 end | |
| 1101 | |
| 1102 local default_host = module:get_option("http_default_host"); | |
| 1103 if not default_host then | |
| 1104 print("HTTP requests to unknown hosts will return 404 Not Found"); | |
| 1105 else | |
| 1106 print("HTTP requests to unknown hosts will be handled by "..default_host); | |
| 1107 end | |
| 1108 return true; | |
| 1109 end | |
| 1110 | |
| 1084 ------------- | 1111 ------------- |
| 1085 | 1112 |
| 1086 function printbanner(session) | 1113 function printbanner(session) |
| 1087 local option = module:get_option("console_banner"); | 1114 local option = module:get_option("console_banner"); |
| 1088 if option == nil or option == "full" or option == "graphic" then | 1115 if option == nil or option == "full" or option == "graphic" then |