net.http.parser: Convert status_code to a number before trying to compare it to numbers
authorMatthew Wild <mwild1@gmail.com>
Thu, 11 Apr 2013 18:58:53 +0000 (19:58 +0100)
committerMatthew Wild <mwild1@gmail.com>
Thu, 11 Apr 2013 18:58:53 +0000 (19:58 +0100)
net/http/parser.lua

index 73a8fb6a4287d609c509b0589a10a6d83b799826..684d62febcef2189945d68f0633fea0df21afe64 100644 (file)
@@ -65,6 +65,7 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb)
                                                        first_line = line;
                                                        if client then
                                                                httpversion, status_code, reason_phrase = line:match("^HTTP/(1%.[01]) (%d%d%d) (.*)$");
+                                                               status_code = tonumber(status_code);
                                                                if not status_code then error = true; return error_cb("invalid-status-line"); end
                                                                have_body = not
                                                                         ( (options_cb and options_cb().method == "HEAD")