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 19:58:53 +0100
changeset 5462 3ecae471d9dd
parent 5461 67b674f6a299
child 5463 111953bfe767
net.http.parser: Convert status_code to a number before trying to compare it to numbers
net/http/parser.lua
--- a/net/http/parser.lua	Thu Apr 11 17:39:10 2013 +0100
+++ b/net/http/parser.lua	Thu Apr 11 19:58:53 2013 +0100
@@ -65,6 +65,7 @@
 							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")