Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket activation #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Commits on Jun 10, 2021

  1. Use MHD_OPTION_ARRAY to pass extra options to MHD_start_daemon

    The call to MHD_start_daemon() was duplicated twice, with slightly
    different options, for ssl vs non-ssl.
    
    Use MHD_OPTION_ARRAY so that the same call can be used for both with the
    ssl option passed via the array.
    
    This removes some duplicated code.  Right now it is not much, because
    ssl is the only option.  It will make a much difference when there is
    another option.  The current method will require a different call for
    every possible combination of options.
    xyzzy42 committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    57a81b8 View commit details
    Browse the repository at this point in the history
  2. Continue when socket can't be used

    This doesn't really do much of anything.  Mostly it changes the flow so
    a socket bind address failure continues instead having the rest of
    the loop inside an if statement.
    
    So it makes a bunch of code indented one level fewer.
    
    The real reason is so the next commit, when the socket address might not
    be used, doesn't need to do this.  That way it doesn't look like a lot
    of code is being re-written when it's not.
    xyzzy42 committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    6656f44 View commit details
    Browse the repository at this point in the history
  3. Add support for socket based activation

    This allows using with systemd socket units.  It works like the old
    inetd style activation.
    
    The socket(s) to open are described in systemd socket units, and when a
    connection is made, systemd starts webdavd and passes the sockets to it
    on some file descriptors.
    
    This way webdavd doesn't need to be running until it's used.  Systemd
    also supports a lot more options for how it can listen on a socket.
    E.g., sockets can be bound to a specific interface and UNIX domain
    sockets can be used.
    
    Multiple sockets can be used, e.g. http and https.  Systemd will pass
    all of them to webdavd.
    
    libminihttpd supports this already and can take an existing fd as the
    socket.
    
    I use a systemd function that does some handy stuff, so this requires
    systemd's libraries.  So that this isn't a hard dependency, it's
    protected in the build system by requiring HAVE_SYSTEMD to be set at
    build time, e.g. make HAVE_SYSTEMD=1.
    
    One could add support for the old inetd server, but I didn't since it's
    not been included with with Fedora for years.
    xyzzy42 committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    1da09aa View commit details
    Browse the repository at this point in the history
  4. Add socket units and package with RPM

    This enables the systemd socket activation support when building the
    RPM.
    
    It includes two sample socket unit files.  They will start webdavd if
    there is a connection on either the http or https port.
    
    They can be used by starting/enabling the socket units instead of the
    service unit.  It's possible to enable either or both of the socket
    units.
    
    and also
    xyzzy42 committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    270f57c View commit details
    Browse the repository at this point in the history