diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-27 23:11:23 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-27 23:11:23 +0100 |
commit | fb9c619707409485b4b1afbd5585785759c6922d (patch) | |
tree | 490a1c1038ac91d4f0b047faf54f9ea77980196f /plugins | |
parent | 987c79e4d0cbf7c35a6201603813a3a0ff491db2 (diff) | |
download | prosody-fb9c619707409485b4b1afbd5585785759c6922d.tar.gz prosody-fb9c619707409485b4b1afbd5585785759c6922d.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')
-rw-r--r-- | plugins/mod_http.lua | 7 |
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", { |