net/httpserver.lua

changeset 1550
03f89de65d9f
parent 1536
8214458eacc8
child 1608
fb53fe17af36
equal deleted inserted replaced
1548:b88b30c9e688 1550:03f89de65d9f
248 if params.base then 248 if params.base then
249 http_server.handlers[params.base] = params.handler; 249 http_server.handlers[params.base] = params.handler;
250 end 250 end
251 end 251 end
252 252
253 function new_from_config(ports, handle_request) 253 function new_from_config(ports, default_base, handle_request)
254 for _, options in ipairs(ports) do 254 for _, options in ipairs(ports) do
255 local port, base, ssl, interface = 5280, "http-bind", false, nil; 255 local port, base, ssl, interface = 5280, default_base, false, nil;
256 if type(options) == "number" then 256 if type(options) == "number" then
257 port = options; 257 port = options;
258 elseif type(options) == "table" then 258 elseif type(options) == "table" then
259 port, base, ssl, interface = options.port or 5280, options.path or "http-bind", options.ssl or false, options.interface; 259 port, base, ssl, interface = options.port or 5280, options.path or default_base, options.ssl or false, options.interface;
260 elseif type(options) == "string" then 260 elseif type(options) == "string" then
261 base = options; 261 base = options;
262 end 262 end
263 263
264 if ssl then 264 if ssl then

mercurial