Software /
code /
prosody
Diff
net/http/parser.lua @ 5259:c85c348253bd
net.http.parser: Skip url.parse when we don't have a full URL (also fixes traceback on paths starting with '//').
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 21 Dec 2012 13:37:39 +0500 |
parent | 5222:61c47d26481d |
child | 5291:01f7522049fb |
line wrap: on
line diff
--- 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;