aboutsummaryrefslogtreecommitdiffstats
path: root/net/http
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
commitb0b093e7264da1a620a2f4e9101e1b676ea1db0e (patch)
tree55ad13e75a14f741bef40986e4dddee8efbdc4ba /net/http
parent84cfab103067b8cebb98b049250eff74bf353eaf (diff)
downloadprosody-b0b093e7264da1a620a2f4e9101e1b676ea1db0e.tar.gz
prosody-b0b093e7264da1a620a2f4e9101e1b676ea1db0e.zip
net.http.parser: Handle full URLs in status line.
Diffstat (limited to 'net/http')
-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;