net.http.parser: Collapse multiple consecutive slashes in a path to a single slash
authorMatthew Wild <mwild1@gmail.com>
Thu, 29 Nov 2012 07:38:00 +0500
changeset 5207 c5edb08fc7cb
parent 5204 0b4f680ea116
child 5208 afa9b7e18e43
child 5209 f5d121846d53
net.http.parser: Collapse multiple consecutive slashes in a path to a single slash
net/http/parser.lua
--- a/net/http/parser.lua	Thu Nov 29 07:15:04 2012 +0500
+++ b/net/http/parser.lua	Thu Nov 29 07:38:00 2012 +0500
@@ -5,7 +5,7 @@
 local urldecode = require "net.http".urldecode;
 
 local function preprocess_path(path)
-	path = urldecode(path);
+	path = urldecode((path:gsub("//+". "/")));
 	if path:sub(1,1) ~= "/" then
 		path = "/"..path;
 	end