Software /
code /
prosody
Comparison
plugins/mod_httpserver.lua @ 2355:08f02de5ab9d
mod_httpserver: Delay setup until after server is started.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 10 Dec 2009 16:21:33 +0500 |
parent | 1870:5b5e4a4ecb55 |
child | 2356:6d1e745a96f8 |
comparison
equal
deleted
inserted
replaced
2354:5a00668ba0ab | 2355:08f02de5ab9d |
---|---|
54 local path = preprocess_path(request.url.path); | 54 local path = preprocess_path(request.url.path); |
55 if not path then return response_400; end | 55 if not path then return response_400; end |
56 return serve_file(path); | 56 return serve_file(path); |
57 end | 57 end |
58 | 58 |
59 local ports = config.get(module.host, "core", "http_ports") or { 5280 }; | 59 local function setup() |
60 httpserver.set_default_handler(handle_default_request); | 60 local ports = config.get(module.host, "core", "http_ports") or { 5280 }; |
61 httpserver.new_from_config(ports, handle_file_request, { base = "files" }); | 61 httpserver.set_default_handler(handle_default_request); |
62 httpserver.new_from_config(ports, handle_file_request, { base = "files" }); | |
63 end | |
64 if prosody.start_time then -- already started | |
65 setup(); | |
66 else | |
67 prosody.events.add_handler("server-started", setup); | |
68 end |