Mercurial > prosody-modules
comparison mod_xml_status/mod_xml_status.lua @ 532:967ba17b1d2a
mod_xml_status: stick to one code "punctuation" style.
| author | Marco Cirillo <maranda@lightwitch.org> |
|---|---|
| date | Sat, 07 Jan 2012 18:14:14 +0000 |
| parents | caf28c2c56a1 |
| children |
comparison
equal
deleted
inserted
replaced
| 531:2b71ba2739e0 | 532:967ba17b1d2a |
|---|---|
| 89 end | 89 end |
| 90 | 90 |
| 91 -- http handlers | 91 -- http handlers |
| 92 | 92 |
| 93 local function response(code, r, h) | 93 local function response(code, r, h) |
| 94 local response = { | 94 local response = { status = code, body = r } |
| 95 status = code; | |
| 96 body = r; | |
| 97 } | |
| 98 | 95 |
| 99 if h then response.headers = h; end | 96 if h then response.headers = h end |
| 100 return response | 97 return response |
| 101 end | 98 end |
| 102 | 99 |
| 103 local function request(method, body, request) | 100 local function request(method, body, request) |
| 104 if method == "GET" then | 101 if method == "GET" then |
| 114 local function setup() | 111 local function setup() |
| 115 httpserver.new_from_config(ports, request, { base = "xml-status" }) | 112 httpserver.new_from_config(ports, request, { base = "xml-status" }) |
| 116 end | 113 end |
| 117 | 114 |
| 118 if prosody.start_time then | 115 if prosody.start_time then |
| 119 setup(); | 116 setup() |
| 120 else | 117 else |
| 121 module:hook("server-started", setup); | 118 module:hook("server-started", setup) |
| 122 end | 119 end |
