3.1 URLs

JOH components are able to handle three socket families: UNIX sockets, IPv4 and IPv6. URLs provide a uniform way of specifying socket addresses in any of these families.

A URL consists of the following parts:

 
  scheme://adress:port

Up to two parts can be omitted, if that does not create ambiguity.

Valid URL schemes are:

unix

Specifies a UNIX socket. The address part is the socket pathname, and the ‘:port’ part is not used. The pathname must be absolute, e.g. ‘unix:///var/run/joh.socket’.

To facilitate typing, the two slashes after the colon can be omitted, as in:

 
unix:/var/run/joh.socket
inet

Specifies an IPv4 socket. The address part must be an IPv4 address in dotted quad form, or a host name. If the latter resolves to multiple addresses, those belonging to the IPv4 family are selected. The port part is either the network port number in decimal, or a corresponding service name from ‘/etc/services’. For example:

 
inet://127.0.0.1:1100
inet6

Specifies an IPv6 socket. The address part must be either an IPv6 address in numeric notation enclosed in square brackets or a host name. If the latter resolves to multiple addresses, those belonging to the IPv6 family are selected. The port part is either the network port number in decimal, or a corresponding service name from ‘/etc/services’. E.g.:

 
inet6://[::1]:1100

For URLs given as argument to the ‘-l’ option, either address or port can be omitted. If address is omitted, the program will listen on all available network interfaces with addresses from the specified family, e.g.:

 
inet6://:1100

instructs johd to listen on port 1100 on all IPv6 interfaces.

If port is omitted, the default is selected depending upon the class of the socket: 1100 is used for ‘CGI’ sockets, and 80 is used for ‘HTTP’ sockets.

The port component can also be omitted in URLs which are arguments to the ‘-s’ option (see default jabber server). In this case, port defaults to 5222, e.g.:

 
inet6://[::1]
inet://127.0.0.1

For compatibility with earlier versions, johd accepts IPv6 addresses without square brackets, although such use is not recommended, e.g.:

 
inet6://::1:1100

If the scheme part is omitted, johd tries to do its best to guess what address family is assumed. Thus:

/var/run/socket’ is treated as ‘unix:///var/run/socket’;

127.0.0.1’ is treated as ‘inet://127.0.0.1’;

[::1]:3398’ is treated as ‘inet6://[::1]:3398’;

::1:3398’ is treated as ‘inet6://[::1]:3398’;

The URL ‘3456’ causes johd to listen on port 3456 on all available network interfaces, no matter what their address family is.