net.http.parser: Skip url.parse when we don't have a full URL (also fixes traceback on paths starting with '//').
--- a/net/http/parser.lua Fri Dec 21 09:04:02 2012 +0100
+++ b/net/http/parser.lua Fri Dec 21 13:37:39 2012 +0500
@@ -91,7 +91,14 @@
responseheaders = headers;
};
else
- local parsed_url = url_parse(path);
+ local parsed_url;
+ if path:byte() == 47 then -- starts with /
+ local _path, _query = path:match("([^?]*).?(.*)");
+ if _query == "" then _query = nil; end
+ parsed_url = { path = _path, query = _query };
+ else
+ parsed_url = url_parse(path);
+ end
path = preprocess_path(parsed_url.path);
headers.host = parsed_url.host or headers.host;