connection handler-case
This commit is contained in:
parent
a77b2e06c0
commit
93c1b6cc4d
|
@ -1,4 +1,5 @@
|
||||||
(in-package #:geml.server)
|
(in-package #:geml.server)
|
||||||
|
|
||||||
(defun ensure-cert (certs-dir)
|
(defun ensure-cert (certs-dir)
|
||||||
(lambda (setting)
|
(lambda (setting)
|
||||||
(let* ((domain (string-downcase (symbol-name (car setting))))
|
(let* ((domain (string-downcase (symbol-name (car setting))))
|
||||||
|
@ -87,12 +88,14 @@
|
||||||
;; * https://en.wikipedia.org/wiki/Server_Name_Indication
|
;; * https://en.wikipedia.org/wiki/Server_Name_Indication
|
||||||
(let* ((domain (string-downcase
|
(let* ((domain (string-downcase
|
||||||
(car (first (without-global settings)))))
|
(car (first (without-global settings)))))
|
||||||
(tls-conn (cl+ssl:make-ssl-server-stream
|
(tls-conn (handler-case (cl+ssl:make-ssl-server-stream
|
||||||
(usocket:socket-stream
|
(usocket:socket-stream
|
||||||
(usocket:socket-accept server))
|
(usocket:socket-accept server))
|
||||||
:external-format '(:utf-8 :eol-style :crlf)
|
:external-format '(:utf-8 :eol-style :crlf)
|
||||||
:certificate (format nil "~A~A.crt" certs-dir domain)
|
:certificate (format nil "~A~A.crt" certs-dir domain)
|
||||||
:key (format nil "~A~A.key" certs-dir domain))))
|
:key (format nil "~A~A.key" certs-dir domain))
|
||||||
|
;; TODO handle more specific cases
|
||||||
|
(error (c) (format t "TLS Error: ~A~%" c)))))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(handle-request tls-conn settings)
|
(handle-request tls-conn settings)
|
||||||
(close tls-conn)))))
|
(close tls-conn)))))
|
||||||
|
|
Loading…
Reference in a new issue