diff options
author | Kim Alvefur <zash@zash.se> | 2015-02-21 10:45:24 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-02-21 10:45:24 +0100 |
commit | 9ed000c898c88bf13d372b77afcf986ff937ca5b (patch) | |
tree | be2b22a52a3523d84b2550ded4489cd85efecc31 /net/http.lua | |
parent | 075278ff98d8d5d8026b07b277cef08a474a6eec (diff) | |
download | prosody-9ed000c898c88bf13d372b77afcf986ff937ca5b.tar.gz prosody-9ed000c898c88bf13d372b77afcf986ff937ca5b.zip |
net.*: Remove use of module() function
Diffstat (limited to 'net/http.lua')
-rw-r--r-- | net/http.lua | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/net/http.lua b/net/http.lua index e6bf0018..80011b59 100644 --- a/net/http.lua +++ b/net/http.lua @@ -24,7 +24,7 @@ local assert, error = assert, error local log = require "util.logger".init("http"); -module "http" +local _ENV = nil; local requests = {}; -- Open requests @@ -76,6 +76,13 @@ function listener.ondetach(conn) requests[conn] = nil; end +local function destroy_request(request) + if request.conn then + request.conn = nil; + request.handler:close() + end +end + local function request_reader(request, data, err) if not request.parser then local function error_cb(reason) @@ -107,7 +114,7 @@ local function request_reader(request, data, err) end local function handleerr(err) log("error", "Traceback[http]: %s", traceback(tostring(err), 2)); end -function request(u, ex, callback) +local function request(u, ex, callback) local req = url.parse(u); if not (req and req.host) then @@ -189,17 +196,12 @@ function request(u, ex, callback) return req; end -function destroy_request(request) - if request.conn then - request.conn = nil; - request.handler:close() - end -end - -local urlencode, urldecode = util_http.urlencode, util_http.urldecode; -local formencode, formdecode = util_http.formencode, util_http.formdecode; - -_M.urlencode, _M.urldecode = urlencode, urldecode; -_M.formencode, _M.formdecode = formencode, formdecode; - -return _M; +return { + request = request; + + -- COMPAT + urlencode = util_http.urlencode; + urldecode = util_http.urldecode; + formencode = util_http.formencode; + formdecode = util_http.formdecode; +}; |