[hunchentoot-devel] socket-connector and ssl-socket-connector?

Cyrus Harmon ch-tbnl at bobobeach.com
Sun Apr 17 22:13:53 UTC 2011


I've been playing around with some changes to ACCEPTOR and friends that introduce the new classes SOCKET-CONNECTOR and SSL-SOCKET-CONNECTOR. The purpose of these changes are to take the specialized socket handling behavior out of the acceptor and into another class, such that subclassing acceptor isn't required to, say, use SSL streams.

As a motivating example, consider the following:

(hunchentoot:start
 (make-instance 
  'hunchentoot:easy-acceptor
  :port 4243
  :socket-connector
  (make-instance 
   'hunchentoot::ssl-socket-connector
   :ssl-certificate-file (asdf:system-relative-pathname
                          :hunchentoot "ssl/certificate.pem")
   :ssl-privatekey-file (asdf:system-relative-pathname
                         :hunchentoot "ssl/key.pem"))))

(hunchentoot:define-easy-handler (say-yo :uri "/yo") (name)
  (setf (hunchentoot:content-type*) "text/plain")
  (format nil "Hey~@[ ~A~]!" name))


Without these changes, one would have to subclass both easy-acceptor and ssl-acceptor in order to have an SSL-using easy acceptor. Comments/suggestions greatly appreciated.

The changes can be found in the git repo at:

https://github.com/slyrus/hunchentoot/tree/socket-connector

and in the attached patch.

Cyrus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hunchentoot-socket-connector.patch
Type: application/octet-stream
Size: 14978 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20110417/fdffced3/attachment.obj>


More information about the Tbnl-devel mailing list