Changeset

4911:4c8575b09ff6

mod_http: Fix normalize_path('/') to not return an empty string, fixes module:http_url()
author Kim Alvefur <zash@zash.se>
date Fri, 25 May 2012 03:39:45 +0200
parents 4910:e5ec60dfb202
children 4912:8d0643281fe2
files plugins/mod_http.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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