Diff

plugins/mod_http.lua @ 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
parent 4892:6c8074f47ca4
child 4915:3fbc01d1fc5a
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