diff options
author | Waqas Hussain <waqas20@gmail.com> | 2012-12-21 13:37:39 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2012-12-21 13:37:39 +0500 |
commit | 42907ced08178a2a99662148870ff5217959bf78 (patch) | |
tree | f992b525b8b20bc43f2fd518dc6b6e46b4409e05 /net/http/parser.lua | |
parent | b1dd7b0be798b3f446cea7f0e4e1a4f05aea7750 (diff) | |
download | prosody-42907ced08178a2a99662148870ff5217959bf78.tar.gz prosody-42907ced08178a2a99662148870ff5217959bf78.zip |
net.http.parser: Skip url.parse when we don't have a full URL (also fixes traceback on paths starting with '//').
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r-- | net/http/parser.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua index c760a0a4..b53dfa4e 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -91,7 +91,14 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) 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; |