#56 Fix behavior of net.http.request on bad URLs

Reporter Waqas
Owner MattJ
Created
Updated
Stars (0)
Tags
  • Priority-Medium
  • Status-Fixed
  • Type-Defect
  • Milestone-0.4
  1. Waqas on

    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.

  2. MattJ on

    Changes
    • tags Milestone-0.3 Milestone-0.4
  3. 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
  4. 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.

New comment

Not published. Used for spam prevention and optional update notifications.