aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-07-07 13:52:25 +0100
committerMatthew Wild <mwild1@gmail.com>2020-07-07 13:52:25 +0100
commitbfd9789cb197c9d5e2fcba6023976c409172401e (patch)
tree90fc2cb0e0561d6e002f5584667bcaa6aa6c8a65
parent540be50a3c3165d08e7e98d406dd911122d51941 (diff)
downloadprosody-bfd9789cb197c9d5e2fcba6023976c409172401e.tar.gz
prosody-bfd9789cb197c9d5e2fcba6023976c409172401e.zip
net.http: Fix traceback on invalid URL passed to request()
-rw-r--r--net/http.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/http.lua b/net/http.lua
index fe5250ac..0adac26c 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -183,14 +183,15 @@ end
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