emikulic / darkhttpd

When you need a web server in a hurry.
https://unix4lyfe.org/darkhttpd/
ISC License
1.03k stars 83 forks source link

--help / usage sorting is unintuitive #54

Closed hhartzer closed 6 months ago

hhartzer commented 6 months ago

--help output is sorted in a strange way. --forward-https isn't anywhere near the other two --forward-esque options and --ipv6 should probably be next to --port/--addr.

Current output for 1.16:

darkhttpd/1.16, copyright (c) 2003-2024 Emil Mikulic.
usage:  darkhttpd /path/to/wwwroot [flags]

flags:  --port number (default: 8080, or 80 if running as root)
        Specifies which port to listen on for connections.
        Pass 0 to let the system choose any free port for you.

    --addr ip (default: all)
        If multiple interfaces are present, specifies
        which one to bind the listening port to.

    --maxconn number (default: system maximum)
        Specifies how many concurrent connections to accept.

    --log filename (default: stdout)
        Specifies which file to append the request log to.

    --syslog
        Use syslog for request log.

    --chroot (default: don't chroot)
        Locks server into wwwroot directory for added security.

    --daemon (default: don't daemonize)
        Detach from the controlling terminal and run in the background.

    --index filename (default: index.html)
        Default file to serve when a directory is requested.

    --no-listing
        Do not serve listing if directory is requested.

    --mimetypes filename (optional)
        Parses specified file for extension-MIME associations.

    --default-mimetype string (optional, default: application/octet-stream)
        Files with unknown extensions are served as this mimetype.

    --uid uid/uname, --gid gid/gname (default: don't privdrop)
        Drops privileges to given uid:gid after initialization.

    --pidfile filename (default: no pidfile)
        Write PID to the specified file.  Note that if you are
        using --chroot, then the pidfile must be relative to,
        and inside the wwwroot.

    --no-keepalive
        Disables HTTP Keep-Alive functionality.

    --accf (default: don't use acceptfilter)
        Use acceptfilter.  Needs the accf_http module loaded.

    --forward host url (default: don't forward)
        Web forward (301 redirect).
        Requests to the host are redirected to the corresponding url.
        The option may be specified multiple times, in which case
        the host is matched in order of appearance.

    --forward-all url (default: don't forward)
        Web forward (301 redirect).
        All requests are redirected to the corresponding url.

    --no-server-id
        Don't identify the server type in headers
        or directory listings.

    --timeout secs (default: 30)
        If a connection is idle for more than this many seconds,
        it will be closed. Set to zero to disable timeouts.

    --auth username:password
        Enable basic authentication. This is *INSECURE*: passwords
        are sent unencrypted over HTTP, plus the password is visible
        in ps(1) to other users on the system.

    --forward-https
        If the client requested HTTP, forward to HTTPS.
        This is useful if darkhttpd is behind a reverse proxy
        that supports SSL.

    --header 'Header: Value'
        Add a custom header to all responses.
        This option can be specified multiple times, in which case
        the headers are added in order of appearance.

    --ipv6
        Listen on IPv6 address.
emikulic commented 6 months ago

Feel free to re-order.