net.http.parser: Collapse multiple consecutive slashes in a path to a single slash
authorMatthew Wild <mwild1@gmail.com>
Thu, 29 Nov 2012 02:38:00 +0000 (07:38 +0500)
committerMatthew Wild <mwild1@gmail.com>
Thu, 29 Nov 2012 02:38:00 +0000 (07:38 +0500)
net/http/parser.lua

index 964c350d336af1f30ade8945b2820ce92fdc177f..606d750c8a18aba1e63e28c3c9542ecbf67bc256 100644 (file)
@@ -5,7 +5,7 @@ local url_parse = require "socket.url".parse;
 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