changeset 565:9c2eea631811

mod_pastebin: more sensible unconfigured base url formatting, use interface directive if present.
author Marco Cirillo <maranda@lightwitch.org>
date Tue, 17 Jan 2012 01:43:50 +0000
parents 0b52d82ea0b3
children 39a612eb4431
files mod_pastebin/mod_pastebin.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pastebin/mod_pastebin.lua	Tue Jan 17 01:40:58 2012 +0000
+++ b/mod_pastebin/mod_pastebin.lua	Tue Jan 17 01:43:50 2012 +0000
@@ -138,9 +138,13 @@
 		base = options;
 	end
 	
-	base_url = base_url or ("http://"..module:get_host()..(port ~= 80 and (":"..port) or "").."/"..base.."/");
+	if not ssl then
+		base_url = base_url or ("http://"..module:get_host()..(port ~= 80 and (":"..port) or "").."/"..base.."/");
+	else
+		base_url = base_url or ("https://"..module:get_host()..(port ~= 443 and (":"..port) or "").."/"..base.."/");
+	end
 	
-	httpserver.new{ port = port, base = base, handler = handle_request, ssl = ssl }
+	httpserver.new{ interface = interface, port = port, base = base, handler = handle_request, ssl = ssl }
 end
 
 local function set_pastes_metatable()