net.http.request crashes on a bad URL.
- On nil (req is nil)
- on "" (req.host is nil)
- on "http://host" (req.path is nil)
do if not req.path then req.path="/" end
Also, it shouldn't just return nil, err, instead it should call the
callback with 0 as the code. The callback should *always* be called. You
can log an error message for failures.
MattJ
on
Changes
tagsMilestone-0.3 Milestone-0.4
MattJ
on
It now returns nil,"invalid-url" on invalid URLs. It does not call the callback on
this error. It does now call the callback on a valid URL but network timeout, however.
Feel free to try and persuade me on the point above, or just commit it if you really
think the callback need always be called :)
changeset: 903:6737d005a84a
user: Matthew Wild <mwild1@gmail.com>
date: Sat Mar 21 23:48:09 2009 +0000
summary: net.http: Don't throw error on invalid URLs. Fixes #56.
Changes
tags Status-Fixed
Waqas
on
I committed it. My reasoning is that checking for errors in one place is better than
checking for errors both within the callback and outside it.
net.http.request crashes on a bad URL. - On nil (req is nil) - on "" (req.host is nil) - on "http://host" (req.path is nil) do if not req.path then req.path="/" end Also, it shouldn't just return nil, err, instead it should call the callback with 0 as the code. The callback should *always* be called. You can log an error message for failures.
Milestone-0.3Milestone-0.4It now returns nil,"invalid-url" on invalid URLs. It does not call the callback on this error. It does now call the callback on a valid URL but network timeout, however. Feel free to try and persuade me on the point above, or just commit it if you really think the callback need always be called :) changeset: 903:6737d005a84a user: Matthew Wild <mwild1@gmail.com> date: Sat Mar 21 23:48:09 2009 +0000 summary: net.http: Don't throw error on invalid URLs. Fixes #56.
ChangesI committed it. My reasoning is that checking for errors in one place is better than checking for errors both within the callback and outside it.