mod_http: Fix normalize_path('/') to not return an empty string, fixes module:http_url()
authorKim Alvefur <zash@zash.se>
Fri, 25 May 2012 03:39:45 +0200
changeset 4911 4c8575b09ff6
parent 4910 e5ec60dfb202
child 4912 8d0643281fe2
mod_http: Fix normalize_path('/') to not return an empty string, fixes module:http_url()
plugins/mod_http.lua
--- a/plugins/mod_http.lua	Fri May 25 02:32:33 2012 +0100
+++ b/plugins/mod_http.lua	Fri May 25 03:39:45 2012 +0200
@@ -17,8 +17,8 @@
 server.set_default_host(module:get_option_string("http_default_host"));
 
 local function normalize_path(path)
+	if path:sub(-1,-1) == "/" then path = path:sub(1, -2); end
 	if path:sub(1,1) ~= "/" then path = "/"..path; end
-	if path:sub(-1,-1) == "/" then path = path:sub(1, -2); end
 	return path;
 end