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 | 69652ea24bf1d52aa3ee7871f5c67d56c92cfb11 (patch) | |
tree | be2b22a52a3523d84b2550ded4489cd85efecc31 /net/http.lua | |
parent | 27265c20e21d071bc96171da9b8707aec6ea669b (diff) | |
download | prosody-69652ea24bf1d52aa3ee7871f5c67d56c92cfb11.tar.gz prosody-69652ea24bf1d52aa3ee7871f5c67d56c92cfb11.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; +}; |