About Wub: Server/Listener

(Parent)

Listener is a network server which listens for connection attempts and dispatches the connected socket to a handler.

Handler Interface

The protocol handler is a script (specified by -httpd argument, below) which is invoked as follows:

handler Connect $sock $ipaddr $rport args

Where args consists of all the options passed to listener when the Listener was created.

Creating a Listener

A Listener is created by [Listen listen] which takes the following args:

-host
host name used in HTTP replies (default: [info hostname])
-myaddr
ip address to listen on (default: any)
-port
port upon which to listen (default 8015)
-httpd
a script prefix which invokes a handler of an incoming connection (default Httpd)
-id
a unique identifier of this listener (default: system assigned)
-tls
a list of args passed to tls: : socket

All of the arguments passed to [Listen listen] will be passed as args to the protocol handler Connect command.

Some options bound for the protocol handler are important. Notably -dispatch which is specifies the worker script for each request processed by the Httpd protocol stack.

Generating SSL key is very easy, just use these two commands: openssl genrsa -out server-private.pem 1024 openssl req -new -x509 -key server-private.pem -out server-public.pem -days 365

(generated by STX)