net/http/parser.lua
changeset 5222 61c47d26481d
parent 5207 c5edb08fc7cb
child 5259 c85c348253bd
equal deleted inserted replaced
5220:98b71d519fff 5222:61c47d26481d
     3 local assert = assert;
     3 local assert = assert;
     4 local url_parse = require "socket.url".parse;
     4 local url_parse = require "socket.url".parse;
     5 local urldecode = require "net.http".urldecode;
     5 local urldecode = require "net.http".urldecode;
     6 
     6 
     7 local function preprocess_path(path)
     7 local function preprocess_path(path)
     8 	path = urldecode((path:gsub("//+". "/")));
     8 	path = urldecode((path:gsub("//+", "/")));
     9 	if path:sub(1,1) ~= "/" then
     9 	if path:sub(1,1) ~= "/" then
    10 		path = "/"..path;
    10 		path = "/"..path;
    11 	end
    11 	end
    12 	local level = 0;
    12 	local level = 0;
    13 	for component in path:gmatch("([^/]+)/") do
    13 	for component in path:gmatch("([^/]+)/") do