From fb9c619707409485b4b1afbd5585785759c6922d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 27 Apr 2012 23:11:23 +0100 Subject: net.http.server, mod_http: Support http_default_host config option to specify where to direct requests for unknown HTTP vhosts --- plugins/mod_http.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugins/mod_http.lua') 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", { -- cgit v1.2.3