Software /
code /
prosody
Changeset
4709:98bfebb38705
net.server.http: Parse absolute URIs in requests (thanks Maranda)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 26 Apr 2012 15:05:05 +0100 |
parents | 4708:0e324923ff95 |
children | 4710:54ca6511e699 4714:7dedf8cc173c |
files | net/http/server.lua |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/net/http/server.lua Thu Apr 26 14:51:55 2012 +0100 +++ b/net/http/server.lua Thu Apr 26 15:05:05 2012 +0100 @@ -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 @@ 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();