diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-26 15:05:05 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-26 15:05:05 +0100 |
commit | 99e8f3cff54ce9238756023e682e96d59bdde4ae (patch) | |
tree | ef394010b32604fac0bd2a283930fd42783bc33b /net/http/server.lua | |
parent | 1ab99fe8b668463b3e72586426d2b4dff8c5be54 (diff) | |
download | prosody-99e8f3cff54ce9238756023e682e96d59bdde4ae.tar.gz prosody-99e8f3cff54ce9238756023e682e96d59bdde4ae.zip |
net.server.http: Parse absolute URIs in requests (thanks Maranda)
Diffstat (limited to 'net/http/server.lua')
-rw-r--r-- | net/http/server.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/http/server.lua b/net/http/server.lua index d6c3a03a..4f9e1463 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -1,6 +1,7 @@ local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; local parser_new = require "net.http.parser".new; +local url_parse = require "socket.url".parse; local events = require "util.events".new(); local addserver = require "net.server".addserver; local log = require "util.logger".init("http.server"); @@ -101,6 +102,9 @@ function listener.onconnect(conn) local function success_cb(request) --log("debug", "success_cb: %s", request.path); request.secure = secure; + local parsed_dest = url_parse(request.path); + request.url = parsed_dest; + request.path = parsed_dest.path; t_insert(pending, request); if not waiting then process_next(); |