Changeset

1666:d1243b321c45

net.httpserver: Allow overriding default request handler
author Matthew Wild <mwild1@gmail.com>
date Tue, 11 Aug 2009 20:49:19 +0100
parents 1665:2c72b725384e
children 1667:c7bb2264e3b8
files net/httpserver.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/net/httpserver.lua	Tue Aug 11 20:38:48 2009 +0100
+++ b/net/httpserver.lua	Tue Aug 11 20:49:19 2009 +0100
@@ -89,9 +89,6 @@
 		end
 		
 		callback = (request.server and request.server.handlers[base]) or default_handler;
-		if callback == default_handler then
-			log("debug", "Default callback for this request (base: "..tostring(base)..")")
-		end
 	end
 	if callback then
 		if err then
@@ -251,6 +248,10 @@
 	end
 end
 
+function set_default_handler(handler)
+	default_handler = handler;
+end
+
 function new_from_config(ports, default_base, handle_request)
 	for _, options in ipairs(ports) do
 		local port, base, ssl, interface = 5280, default_base, false, nil;