From 0c1a899fbe074da7865cfe967725f21dc09caf0c Mon Sep 17 00:00:00 2001 From: 1848 <> Date: Tue, 7 Aug 2018 19:28:29 +0200 Subject: [PATCH] Added unix socket support in HttpdOutputPlugin --- NEWS | 1 + doc/user.rst | 2 +- src/output/plugins/httpd/HttpdOutputPlugin.cxx | 9 ++------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 18933fa41..761bad5c2 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ ver 0.21 (not yet released) - shout: support the Shine encoder plugin - sndio: remove support for the broken RoarAudio sndio emulation - osx: initial support for DSD over PCM + - httpd_output: support for unix sockets * mixer - sndio: new mixer plugin * encoder diff --git a/doc/user.rst b/doc/user.rst index 1b24931d0..a2649e992 100644 --- a/doc/user.rst +++ b/doc/user.rst @@ -1705,7 +1705,7 @@ It is highly recommended to configure a fixed format, because a stream cannot sw * - **port P** - Binds the HTTP server to the specified port. * - **bind_to_address ADDR** - - Binds the HTTP server to the specified address (IPv4 or IPv6). Multiple addresses in parallel are not supported. + - Binds the HTTP server to the specified address (IPv4, IPv6 or UNIX socket). Multiple addresses in parallel are not supported. * - **encoder NAME** - Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`. * - **max_clients MC** diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx index e7689b55d..e3f6a2b03 100644 --- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx +++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx @@ -33,6 +33,7 @@ #include "util/Domain.hxx" #include "util/DeleteDisposer.hxx" #include "Log.hxx" +#include "config/Net.hxx" #include @@ -58,17 +59,11 @@ HttpdOutput::HttpdOutput(EventLoop &_loop, const ConfigBlock &block) genre = block.GetBlockValue("genre", "Set genre in config"); website = block.GetBlockValue("website", "Set website in config"); - unsigned port = block.GetBlockValue("port", 8000u); - clients_max = block.GetBlockValue("max_clients", 0u); /* set up bind_to_address */ - const char *bind_to_address = block.GetBlockValue("bind_to_address"); - if (bind_to_address != nullptr && strcmp(bind_to_address, "any") != 0) - AddHost(bind_to_address, port); - else - AddPort(port); + ServerSocketAddGeneric(*this, block.GetBlockValue("bind_to_address"), block.GetBlockValue("port", 8000u)); /* determine content type */ content_type = prepared_encoder->GetMimeType();