Changeset

10994:e2ce067bb59a 0.11

net.http: Fix traceback on invalid URL passed to request()
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 Jul 2020 13:52:25 +0100
parents 10951:f4215f8baa5d
children 10995:e18a913aed2d 11007:1d8e1f7a587c
files net/http.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/http.lua	Tue Jun 23 15:43:57 2020 +0200
+++ b/net/http.lua	Tue Jul 07 13:52:25 2020 +0100
@@ -183,14 +183,15 @@
 
 local function request(self, u, ex, callback)
 	local req = url.parse(u);
-	req.url = u;
-	req.http = self;
 
 	if not (req and req.host) then
 		callback("invalid-url", 0, req);
 		return nil, "invalid-url";
 	end
 
+	req.url = u;
+	req.http = self;
+
 	if not req.path then
 		req.path = "/";
 	end