Mercurial > prosody-hg
comparison net/http/parser.lua @ 14170:948bda5ed45f 13.0
net.http.parser: Include final component in path normalization check
This matches the pattern that is already used by net.http.files when
normalizing the path.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 25 May 2026 13:06:51 +0100 |
| parents | 79a6598cef0b |
| children | 190d172ab021 |
comparison
equal
deleted
inserted
replaced
| 14169:58ca617f68d5 | 14170:948bda5ed45f |
|---|---|
| 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 |
| 14 if component == ".." then | 14 if component == ".." then |
| 15 level = level - 1; | 15 level = level - 1; |
| 16 elseif component ~= "." then | 16 elseif component ~= "." then |
| 17 level = level + 1; | 17 level = level + 1; |
| 18 end | 18 end |
