Commit e5be3524 authored by Marek Vavruša's avatar Marek Vavruša Committed by Vladimír Čunát

modules/http: allow listening on UNIX sockets

parent 72e0a76b
Pipeline #42238 canceled with stages
in 3 minutes and 22 seconds
......@@ -310,12 +310,26 @@ function M.add_interface(conf)
warn('[http] the "reuseport" option is disabled and multiple forks are used, ' ..
'port binding will fail on some instances')
end
-- Check if UNIX socket path is used
local addr_str
if not conf.path then
conf.host = conf.host or 'localhost'
conf.port = conf.port or 8053
addr_str = string.format('%s@%d', conf.host, conf.port)
else
if conf.host or conf.port then
error('either "path", or "host" and "port" must be provided')
end
addr_str = conf.path
end
-- Create TLS context and start listening
local s, err = http_server.listen {
cq = worker.bg_worker.cq,
host = conf.host or 'localhost',
port = conf.port or 8053,
host = conf.host,
port = conf.port,
path = conf.path,
v6only = conf.v6only,
unlink = conf.unlink,
reuseaddr = conf.reuseaddr,
reuseport = reuseport,
client_timeout = conf.client_timeout or 5,
......@@ -338,7 +352,7 @@ function M.add_interface(conf)
err = select(2, s:listen())
end
if err then
panic('failed to listen on %s@%d: %s', conf.host, conf.port, err)
panic('failed to listen on %s: %s', addr_str, err)
end
table.insert(M.servers, s)
-- Create certificate renewal timer if ephemeral
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment