Software /
code /
prosody-modules
Comparison
mod_pastebin/mod_pastebin.lua @ 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 |
parent | 517:f866325305ed |
child | 654:7e444de959bb |
comparison
equal
deleted
inserted
replaced
564:0b52d82ea0b3 | 565:9c2eea631811 |
---|---|
136 port, base, ssl, interface = options.port or 5280, options.path or "pastebin", options.ssl or false, options.interface; | 136 port, base, ssl, interface = options.port or 5280, options.path or "pastebin", options.ssl or false, options.interface; |
137 elseif type(options) == "string" then | 137 elseif type(options) == "string" then |
138 base = options; | 138 base = options; |
139 end | 139 end |
140 | 140 |
141 base_url = base_url or ("http://"..module:get_host()..(port ~= 80 and (":"..port) or "").."/"..base.."/"); | 141 if not ssl then |
142 base_url = base_url or ("http://"..module:get_host()..(port ~= 80 and (":"..port) or "").."/"..base.."/"); | |
143 else | |
144 base_url = base_url or ("https://"..module:get_host()..(port ~= 443 and (":"..port) or "").."/"..base.."/"); | |
145 end | |
142 | 146 |
143 httpserver.new{ port = port, base = base, handler = handle_request, ssl = ssl } | 147 httpserver.new{ interface = interface, port = port, base = base, handler = handle_request, ssl = ssl } |
144 end | 148 end |
145 | 149 |
146 local function set_pastes_metatable() | 150 local function set_pastes_metatable() |
147 if expire_after == 0 then | 151 if expire_after == 0 then |
148 local dm = require "util.datamanager"; | 152 local dm = require "util.datamanager"; |