Verified 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')
-- Check if UNIX socket path is used
local addr_str
if not conf.path then = or 'localhost'
conf.port = conf.port or 8053
addr_str = string.format('%s@%d',, conf.port)
if or conf.port then
error('either "path", or "host" and "port" must be provided')
addr_str = conf.path
-- Create TLS context and start listening
local s, err = http_server.listen {
cq = worker.bg_worker.cq,
host = or 'localhost',
port = conf.port or 8053,
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())
if err then
panic('failed to listen on %s@%d: %s',, conf.port, err)
panic('failed to listen on %s: %s', addr_str, err)
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