aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-27 23:11:23 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-27 23:11:23 +0100
commite865b1b3fe06dd681f121fd0147608f47a8bfc34 (patch)
tree490a1c1038ac91d4f0b047faf54f9ea77980196f /plugins/mod_http.lua
parent14dcbf13d5fc2dc4ded9d51176284347bfbe8374 (diff)
downloadprosody-e865b1b3fe06dd681f121fd0147608f47a8bfc34.tar.gz
prosody-e865b1b3fe06dd681f121fd0147608f47a8bfc34.zip
net.http.server, mod_http: Support http_default_host config option to specify where to direct requests for unknown HTTP vhosts
Diffstat (limited to 'plugins/mod_http.lua')
-rw-r--r--plugins/mod_http.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index ef3f0271..c379a562 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -10,6 +10,8 @@ module:set_global();
local server = require "net.http.server";
+server.set_default_host(module:get_option_string("http_default_host"));
+
local function normalize_path(path)
if path:sub(1,1) ~= "/" then path = "/"..path; end
if path:sub(-1,-1) == "/" then path = path:sub(1, -2); end
@@ -83,6 +85,11 @@ function module.add_host(module)
end
module:handle_items("http-provider", http_app_added, http_app_removed);
+
+ server.add_host(host);
+ function module.unload()
+ server.remove_host(host);
+ end
end
module:add_item("net-provider", {