Software /
code /
prosody
Comparison
net/http/server.lua @ 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 |
parent | 4706:845393c76d17 |
child | 4710:54ca6511e699 |
child | 4714:7dedf8cc173c |
comparison
equal
deleted
inserted
replaced
4708:0e324923ff95 | 4709:98bfebb38705 |
---|---|
1 | 1 |
2 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; | 2 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; |
3 local parser_new = require "net.http.parser".new; | 3 local parser_new = require "net.http.parser".new; |
4 local url_parse = require "socket.url".parse; | |
4 local events = require "util.events".new(); | 5 local events = require "util.events".new(); |
5 local addserver = require "net.server".addserver; | 6 local addserver = require "net.server".addserver; |
6 local log = require "util.logger".init("http.server"); | 7 local log = require "util.logger".init("http.server"); |
7 local os_date = os.date; | 8 local os_date = os.date; |
8 local pairs = pairs; | 9 local pairs = pairs; |
99 end | 100 end |
100 end | 101 end |
101 local function success_cb(request) | 102 local function success_cb(request) |
102 --log("debug", "success_cb: %s", request.path); | 103 --log("debug", "success_cb: %s", request.path); |
103 request.secure = secure; | 104 request.secure = secure; |
105 local parsed_dest = url_parse(request.path); | |
106 request.url = parsed_dest; | |
107 request.path = parsed_dest.path; | |
104 t_insert(pending, request); | 108 t_insert(pending, request); |
105 if not waiting then | 109 if not waiting then |
106 process_next(); | 110 process_next(); |
107 end | 111 end |
108 end | 112 end |