Software /
code /
prosody
Changeset
8534:c071cabfa066
net.http: Remove use of 'conn' (raw socket object returned by addclient)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 23 Feb 2018 16:20:45 +0000 |
parents | 8533:66cdf5c7af85 |
children | 8535:b6f3b34ecc03 |
files | net/http.lua |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/net/http.lua Fri Feb 23 17:11:59 2018 +0100 +++ b/net/http.lua Fri Feb 23 16:20:45 2018 +0000 @@ -100,9 +100,10 @@ end local function destroy_request(request) - if request.conn then + local conn = request.conn; + if conn then request.conn = nil; - request.handler:close() + conn:close() end end @@ -221,14 +222,14 @@ sslctx = ex and ex.sslctx or self.options and self.options.sslctx; end - local handler, conn = server.addclient(host, port_number, listener, "*a", sslctx) + local handler, ret = server.addclient(host, port_number, listener, "*a", sslctx) if not handler then - self.events.fire_event("request-connection-error", { http = self, request = req, url = u, err = conn }); - callback(conn, 0, req); - return nil, conn; + self.events.fire_event("request-connection-error", { http = self, request = req, url = u, err = ret }); + callback(ret, 0, req); + return nil, ret; end - req.handler, req.conn = handler, conn - req.write = function (...) return req.handler:write(...); end + req.conn = handler + req.write = function (...) return req.conn:write(...); end req.callback = function (content, code, response, request) do @@ -243,7 +244,7 @@ req.reader = request_reader; req.state = "status"; - requests[req.handler] = req; + requests[req.conn] = req; self.events.fire_event("request", { http = self, request = req, url = u }); return req;