diff options
author | Waqas Hussain <waqas20@gmail.com> | 2012-04-22 23:44:21 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2012-04-22 23:44:21 +0500 |
commit | c065013cedb83885226e5870a34cf4c2add53450 (patch) | |
tree | 90892d5b5594acbec8c71314ef370a3d3147e79e | |
parent | 1e7af784820756180d503a34fd86d4f685d42f65 (diff) | |
download | prosody-c065013cedb83885226e5870a34cf4c2add53450.tar.gz prosody-c065013cedb83885226e5870a34cf4c2add53450.zip |
net.http.server: Fix legacy net.httpserver fallback (httpserver is no longer a global).
-rw-r--r-- | net/http/server.lua | 5 |
1 files 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 }; |