Software /
code /
prosody
Diff
plugins/mod_http.lua @ 4736:3514338c59c3
net.http.server, mod_http: Support http_default_host config option to specify where to direct requests for unknown HTTP vhosts
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 27 Apr 2012 23:11:23 +0100 |
parent | 4724:a8c234332258 |
child | 4774:b2ed4e1bcb6e |
line wrap: on
line diff
--- a/plugins/mod_http.lua Fri Apr 27 22:37:56 2012 +0100 +++ b/plugins/mod_http.lua Fri Apr 27 23:11:23 2012 +0100 @@ -10,6 +10,8 @@ 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 @@ 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", {