From c065013cedb83885226e5870a34cf4c2add53450 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 22 Apr 2012 23:44:21 +0500 Subject: net.http.server: Fix legacy net.httpserver fallback (httpserver is no longer a global). --- net/http/server.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/http/server.lua b/net/http/server.lua index 1f61c7b9..3a0cb53a 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -13,6 +13,7 @@ local debug = debug; local tostring = tostring; local codes = require "net.http.codes"; local _G = _G; +local legacy_httpserver = require "net.httpserver"; local _M = {}; @@ -159,9 +160,9 @@ end function _M.legacy_handler(request, response) log("debug", "Invoking legacy handler"); local base = request.path:match("^/([^/?]+)"); - local legacy_server = _G.httpserver and _G.httpserver.new.http_servers[5280]; + local legacy_server = legacy_httpserver and legacy_httpserver.new.http_servers[5280]; local handler = legacy_server and legacy_server.handlers[base]; - if not handler then handler = _G.httpserver and _G.httpserver.set_default_handler.default_handler; end + if not handler then handler = legacy_httpserver and legacy_httpserver.set_default_handler.default_handler; end if handler then -- add legacy properties to request object request.url = { path = request.path }; -- cgit v1.2.3