aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/parser.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2012-04-26 20:07:13 +0500
committerWaqas Hussain <waqas20@gmail.com>2012-04-26 20:07:13 +0500
commit91393747a3aa127e13ba07bc71340c59b708430d (patch)
tree55ad13e75a14f741bef40986e4dddee8efbdc4ba /net/http/parser.lua
parent92345b94978870a084bdfc9929ba046e4b23ed0e (diff)
downloadprosody-91393747a3aa127e13ba07bc71340c59b708430d.tar.gz
prosody-91393747a3aa127e13ba07bc71340c59b708430d.zip
net.http.parser: Handle full URLs in status line.
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r--net/http/parser.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua
index c98c75af..fdcb8ebb 100644
--- a/net/http/parser.lua
+++ b/net/http/parser.lua
@@ -53,7 +53,6 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb)
else
method, path, httpversion = line:match("^(%w+) (%S+) HTTP/(1%.[01])$");
if not method then error = true; return error_cb("invalid-status-line"); end
- path = path:gsub("^//+", "/"); -- TODO parse url more
end
end
end
@@ -71,6 +70,12 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb)
responseheaders = headers;
};
else
+ -- path normalization
+ if path:match("^https?://") then
+ headers.host, path = path:match("^https?://([^/]*)(.*)");
+ end
+ path = path:gsub("^//+", "/"); -- TODO parse url more
+
len = len or 0;
packet = {
method = method;