equal
deleted
inserted
replaced
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 |