# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1337909985 -7200
# Node ID 4c8575b09ff6bb52238c6edd6b54afad8fe85e6b
# Parent  e5ec60dfb2021d63afffb2f8a0a35afea6aa5ce7
mod_http: Fix normalize_path('/') to not return an empty string, fixes module:http_url()

diff -r e5ec60dfb202 -r 4c8575b09ff6 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