Changeset

8046:1bf47706aefb

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 02 Apr 2017 00:24:37 +0200
parents 8044:e38e3300b955 (current diff) 8045:55a56dc935f2 (diff)
children 8049:0909de054b3f
files net/http.lua
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/net/http.lua	Sat Apr 01 22:40:09 2017 +0200
+++ b/net/http.lua	Sun Apr 02 00:24:37 2017 +0200
@@ -68,7 +68,7 @@
 function listener.ondisconnect(conn, err)
 	local request = requests[conn];
 	if request and request.conn then
-		request:reader(nil, err);
+		request:reader(nil, err or "closed");
 	end
 	requests[conn] = nil;
 end
@@ -126,7 +126,7 @@
 	local req = url.parse(u);
 
 	if not (req and req.host) then
-		callback(nil, 0, req);
+		callback("invalid-url", 0, req);
 		return nil, "invalid-url";
 	end
 
@@ -190,7 +190,7 @@
 
 	local handler, conn = server.addclient(host, port_number, listener, "*a", sslctx)
 	if not handler then
-		callback(nil, 0, req);
+		callback(conn, 0, req);
 		return nil, conn;
 	end
 	req.handler, req.conn = handler, conn
--- a/net/http/parser.lua	Sat Apr 01 22:40:09 2017 +0200
+++ b/net/http/parser.lua	Sun Apr 02 00:24:37 2017 +0200
@@ -46,7 +46,7 @@
 					packet.body = buf;
 					success_cb(packet);
 				elseif buf ~= "" then -- unexpected EOF
-					error = true; return error_cb();
+					error = true; return error_cb("unexpected-eof");
 				end
 				return;
 			end