Comparison

net/http.lua @ 8535:b6f3b34ecc03

net.http: Rename handler to conn, for consistency with all our other code
author Matthew Wild <mwild1@gmail.com>
date Fri, 23 Feb 2018 16:21:40 +0000
parent 8534:c071cabfa066
child 8551:2bd2e94a0496
comparison
equal deleted inserted replaced
8534:c071cabfa066 8535:b6f3b34ecc03
220 local sslctx = false; 220 local sslctx = false;
221 if using_https then 221 if using_https then
222 sslctx = ex and ex.sslctx or self.options and self.options.sslctx; 222 sslctx = ex and ex.sslctx or self.options and self.options.sslctx;
223 end 223 end
224 224
225 local handler, ret = server.addclient(host, port_number, listener, "*a", sslctx) 225 local conn, ret = server.addclient(host, port_number, listener, "*a", sslctx)
226 if not handler then 226 if not conn then
227 self.events.fire_event("request-connection-error", { http = self, request = req, url = u, err = ret }); 227 self.events.fire_event("request-connection-error", { http = self, request = req, url = u, err = ret });
228 callback(ret, 0, req); 228 callback(ret, 0, req);
229 return nil, ret; 229 return nil, ret;
230 end 230 end
231 req.conn = handler 231 req.conn = conn
232 req.write = function (...) return req.conn:write(...); end 232 req.write = function (...) return req.conn:write(...); end
233 233
234 req.callback = function (content, code, response, request) 234 req.callback = function (content, code, response, request)
235 do 235 do
236 local event = { http = self, url = u, request = req, response = response, content = content, code = code, callback = callback }; 236 local event = { http = self, url = u, request = req, response = response, content = content, code = code, callback = callback };