Home Contents | # httpd:secureListen | Httpd | Core4 Lua Event System

## SYNOPSIS

flag = httpd:secureListen([port])

## DESCRIPTION

This function is used to start a web server that secures client connections with SSL/TLS.

The Core4 system includes a commercial PolarSSL license.

In order to use SSL/TLS, the server must first be configured with a server certificate (see httpd:loadCertFile()) and a server private key pair (see httpd:loadKeyFile()).

If port is non-nil, starts processing client requests on the specified port. To use the default port for HTTP over SSL/TLS (https://), specify port number 443.

By calling this function with a nil value, the server stops accepting new client request. This is useful if the web server needs to be enabled or disabled dynamically.

When the server is enabled, calling httpd:secureListen() again with a different port number will fail. Disable the server first, then re-enable with the new port number.

## RETURN VALUE

On success, returns true. On error, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the error code. If the error code is a positive number, it is an errno code from the standard C library. A negative number indicates an error code from PolarSSL.

## SEE ALSO

httpd:loadKeyData(), httpd:loadKeyFile(), httpd:listen()