RequestServer.listenSpec

The array of addresses you want to listen on. The format looks like a url but has a few differences.

This ONLY works on embedded_httpd_threads, embedded_httpd_hybrid, and scgi builds at this time.

http://localhost:8080

http://unix:filename/here

scgi://abstract:/name/here

http://[::1]:4444

Note that IPv6 addresses must be enclosed in brackets. If you want to listen on an interface called unix or abstract, contact me, that is not supported but I could add some kind of escape mechanism.

If you leave off the protocol, it assumes the default based on compile flags. If you only give a number, it is assumed to be a port on any tcp interface.

localhost:8080 serves the default protocol.

8080 or :8080 assumes default protocol on localhost.

The protocols can be http:, https:, and scgi:. Original cgi is not supported with this, since it is transactional with a single process.

Valid hosts are an IPv4 address (with a mandatory port), an IPv6 address (with a mandatory port), just a port alone, unix:/path/to/unix/socket (which may be a relative path without a leading slash), or abstract:/path/to/linux/abstract/namespace.

http://unix:foo will serve http over the unix domain socket named foo in the current working directory.

If you set this to anything non-null (including a non-null, zero-length array) any listenSpec entries, listeningHost and listeningPort are ignored.

Bugs

The implementation currently ignores the protocol spec in favor of the default compiled in option.

Meta

History

Added July 31, 2023 (dub v11.0)