Software /
code /
prosody
Comparison
net/http.lua @ 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 |
parent | 9611:2700317f93e4 |
child | 10995:e18a913aed2d |
child | 11015:355eae2f9ba8 |
comparison
equal
deleted
inserted
replaced
10951:f4215f8baa5d | 10994:e2ce067bb59a |
---|---|
181 req.callback(reason or "connection failed", 0, req); | 181 req.callback(reason or "connection failed", 0, req); |
182 end | 182 end |
183 | 183 |
184 local function request(self, u, ex, callback) | 184 local function request(self, u, ex, callback) |
185 local req = url.parse(u); | 185 local req = url.parse(u); |
186 req.url = u; | |
187 req.http = self; | |
188 | 186 |
189 if not (req and req.host) then | 187 if not (req and req.host) then |
190 callback("invalid-url", 0, req); | 188 callback("invalid-url", 0, req); |
191 return nil, "invalid-url"; | 189 return nil, "invalid-url"; |
192 end | 190 end |
191 | |
192 req.url = u; | |
193 req.http = self; | |
193 | 194 |
194 if not req.path then | 195 if not req.path then |
195 req.path = "/"; | 196 req.path = "/"; |
196 end | 197 end |
197 | 198 |