Diff

net/http.lua @ 2130:828e161cdfc7

net.httpserver, net.http: Update for new net.server API (untested)
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 04:44:26 +0000
parent 1522:569d58d21612
child 2363:a1e987f499a8
line wrap: on
line diff
--- a/net/http.lua	Sun Nov 22 04:43:46 2009 +0000
+++ b/net/http.lua	Sun Nov 22 04:44:26 2009 +0000
@@ -152,7 +152,7 @@
 	end
 	
 	req.handler, req.conn = server.wrapclient(socket.tcp(), req.host, req.port or 80, listener, "*a");
-	req.write = req.handler.write;
+	req.write = function (...) return req.handler:write(...); end
 	req.conn:settimeout(0);
 	local ok, err = req.conn:connect(req.host, req.port or 80);
 	if not ok and err ~= "timeout" then
@@ -200,7 +200,7 @@
 function destroy_request(request)
 	if request.conn then
 		request.handler.close()
-		listener.disconnect(request.conn, "closed");
+		listener.ondisconnect(request.conn, "closed");
 	end
 end