Diff

net/http/parser.lua @ 5207:c5edb08fc7cb

net.http.parser: Collapse multiple consecutive slashes in a path to a single slash
author Matthew Wild <mwild1@gmail.com>
date Thu, 29 Nov 2012 07:38:00 +0500
parent 4910:e5ec60dfb202
child 5222:61c47d26481d
line wrap: on
line diff
--- 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