httpd/tls
src/httpd/tls.tur
TLS-terminating listener for upgrade-aware handlers (HTTPS / wss).
Since: WS4 (on stdlib httpd since tourist-on-stdlib-httpd H2)
defn
server-start-tls-conn
(server-start-tls-conn [port : int cert-path : cstr key-path : cstr handler : (c-fn [int int])
bind a TLS listener and dispatch to a two-arg
Parameters
| port | TCP port to bind on (127.0.0.1 unless the program called | |
| httpd-set-bind-any! / httpd-set-bind-addr!). | ||
| cert-path | filesystem path to a PEM server cert (+ optional chain). | |
| key-path | filesystem path to the matching PEM private key (unencrypted). | |
| handler | captureless `(c-fn [int int] int)`. Define it as a top-level | |
| `(defn h [conn : Conn req : Request] : Response ...)`. |
Returns
:ptr<void> -- opaque server handle for server-stop-tls, or NULL on bind / cert-load / thread-spawn failure.
Example
(let [srv (server-start-tls-conn 8443 "cert.pem" "key.pem" ws-handler)]
;; ... wait / signal ...
(server-stop-tls srv))
Since: WS4
defn
server-stop-tls
(server-stop-tls [srv ptr<void>] :)
shut down a TLS server started by server-start-tls-conn.
Parameters
| srv | handle from server-start-tls-conn (NULL is a safe no-op). |
Since: WS4
Internal definitions
htls-null-ptrhtls-null?htls-start