Software /
code /
prosody
Changeset
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 |
parents | 5257:b125892e187c |
children | 5260:87f72452a893 |
files | net/http/parser.lua |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
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;