diff options
author | Waqas Hussain <waqas20@gmail.com> | 2012-04-26 20:07:13 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2012-04-26 20:07:13 +0500 |
commit | b0b093e7264da1a620a2f4e9101e1b676ea1db0e (patch) | |
tree | 55ad13e75a14f741bef40986e4dddee8efbdc4ba /net/http/parser.lua | |
parent | 84cfab103067b8cebb98b049250eff74bf353eaf (diff) | |
download | prosody-b0b093e7264da1a620a2f4e9101e1b676ea1db0e.tar.gz prosody-b0b093e7264da1a620a2f4e9101e1b676ea1db0e.zip |
net.http.parser: Handle full URLs in status line.
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r-- | net/http/parser.lua | 7 |
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; |