[cl-plus-ssl-cvs] CVS cl+ssl

dlichteblau dlichteblau at common-lisp.net
Sat Jul 7 16:47:57 UTC 2007


Update of /project/cl-plus-ssl/cvsroot/cl+ssl
In directory clnet:/tmp/cvs-serv18763

Modified Files:
	index.html streams.lisp 
Log Message:
New keyword argument <tt>close-callback</tt>.


--- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html	2007/07/07 16:26:11	1.11
+++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html	2007/07/07 16:47:57	1.12
@@ -28,7 +28,8 @@
       </li>
       <li>
 	Re-introduced support for direct access to file descriptors as
-	an optimization.  New function <tt>stream-fd</tt>.
+	an optimization.  New function <tt>stream-fd</tt>.  New keyword
+	argument <tt>close-callback</tt>.
       </li>
     </ul>
     <p>
@@ -136,10 +137,15 @@
       </div>
     </p>
     <p>
-      <div class="def">Function CL+SSL:MAKE-SSL-CLIENT-STREAM (fd-or-stream &key external-format certificate key)</div>
+      <div class="def">Function CL+SSL:MAKE-SSL-CLIENT-STREAM (fd-or-stream &key external-format certificate key close-callback)</div>
       Return an SSL stream for the client socket <tt>fd-or-stream</tt>.
       All reads and writes to this SSL stream will be pushed through the
-      SSL connection can be closed using the standard <tt>close</tt> function.
+      SSL connection.  If <tt>fd-or-stream</tt> is a lisp stream, it can
+      the SSL stream will close it automatically.  File descriptors are
+      not closed automatically.  However, if <tt>close-callback</tt> is
+      non-nil, it will be called with zero arguments when the SSL stream
+      is closed.
+      
       <tt>certificate</tt> is the path to a file containing the PEM-encoded
       certificate for your client. <tt>key</tt> is the path to the PEM-encoded
       key for the client, which must not be associated with a passphrase.
@@ -152,11 +158,15 @@
       as its initial external format.
     </p>
     <p>
-      <div class="def">Function CL+SSL:MAKE-SSL-SERVER-STREAM (fd-or-stream &key external-format certificate key)</div>
+      <div class="def">Function CL+SSL:MAKE-SSL-SERVER-STREAM (fd-or-stream &key external-format certificate key close-callback)</div>
       Return an SSL stream for the server socket <tt>fd-or-stream</tt>.  All
       reads and writes to this server stream will be pushed through the
-      OpenSSL library. The SSL connection can be closed using the
-      standard <tt>close</tt> function.
+      OpenSSL library. If <tt>fd-or-stream</tt> is a lisp stream, it can
+      the SSL stream will close it automatically.  File descriptors are
+      not closed automatically.  However, if <tt>close-callback</tt> is
+      non-nil, it will be called with zero arguments when the SSL stream
+      is closed.
+      
       <tt>certificate</tt> is the path to a file containing the PEM-encoded
       certificate for your server. <tt>key</tt> is the path to the PEM-encoded
       key for the server, which must not be associated with a
@@ -188,11 +198,7 @@
       <tr><td>OpenMCL</td><td class="working">Working</td></tr>
       <tr><td>SBCL</td><td class="working">Working</td></tr>
       <tr><td>CMU CL</td><td class="working">Working</td></tr>
-      <tr>
-        <td>CLISP</td>
-        <td class="incomplete">Working</td>
-        <td>Extremely slow?</td>
-      </tr>
+      <tr><td>CLISP</td><td class="working">Working</td></tr>
       <tr><td>LispWorks</td><td class="working">Working</td></tr>
       <tr>
         <td>Allegro</td>
@@ -208,7 +214,6 @@
 
     <h3>TODO</h3>
     <ul>
-      <li>Profile and optimize if needed. (CLISP?)</li>
       <li>CNAME checking!</li>
     </ul>
 
@@ -232,7 +237,7 @@
     </p>
 
     <p>
-      <a href="http://common-lisp.net/cgi-bin/viewcvs.cgi/*checkout*/trivial-https/README?rev=HEAD&cvsroot=cl-plus-ssl&content-type=text/plain">README</a>
+      <a href="http://common-lisp.net/cgi-bin/viewcvs.cgi/*checkout*/trivial-https/README?rev=HEAD&cvsroot=cl-plus-ssl&content-type=text/plain">README</a>
     </p>
 
     <a name="trivial-gray-streams">
@@ -244,7 +249,7 @@
     </p>
 
     <p>
-      <a href="http://common-lisp.net/cgi-bin/viewcvs.cgi/*checkout*/trivial-gray-streams/README?rev=HEAD&cvsroot=cl-plus-ssl&content-type=text/plain">README</a>
+      <a href="http://common-lisp.net/cgi-bin/viewcvs.cgi/*checkout*/trivial-gray-streams/README?rev=HEAD&cvsroot=cl-plus-ssl&content-type=text/plain">README</a>
     </p>
   </body>
 </html>
--- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp	2007/07/07 16:26:11	1.8
+++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp	2007/07/07 16:47:57	1.9
@@ -17,6 +17,9 @@
   ((ssl-stream-socket
     :initarg :socket
     :accessor ssl-stream-socket)
+   (close-callback
+    :initarg :close-callback
+    :accessor ssl-close-callback)
    (handle
     :initform nil
     :accessor ssl-stream-handle)
@@ -54,7 +57,9 @@
   (ssl-free (ssl-stream-handle stream))
   (setf (ssl-stream-handle stream) nil)
   (when (streamp (ssl-stream-socket stream))
-    (close (ssl-stream-socket stream))))
+    (close (ssl-stream-socket stream)))
+  (when (functionp (ssl-close-callback stream))
+    (funcall (ssl-close-callback stream))))
 
 (defmethod open-stream-p ((stream ssl-stream))
   (and (ssl-stream-handle stream) t))
@@ -152,13 +157,16 @@
 ;;; interface functions
 ;;;
 (defun make-ssl-client-stream
-    (socket &key certificate key (method 'ssl-v23-method) external-format)
+    (socket &key certificate key (method 'ssl-v23-method) external-format
+                 close-callback)
   "Returns an SSL stream for the client socket descriptor SOCKET.
 CERTIFICATE is the path to a file containing the PEM-encoded certificate for
  your client. KEY is the path to the PEM-encoded key for the client, which
 must not be associated with a passphrase."
   (ensure-initialized method)
-  (let ((stream (make-instance 'ssl-stream :socket socket))
+  (let ((stream (make-instance 'ssl-stream
+			       :socket socket
+			       :close-callback close-callback))
         (handle (ssl-new *ssl-global-context*)))
     (setf (ssl-stream-handle stream) handle)
     (etypecase socket
@@ -183,7 +191,8 @@
         stream)))
 
 (defun make-ssl-server-stream
-    (socket &key certificate key (method 'ssl-v23-method) external-format)
+    (socket &key certificate key (method 'ssl-v23-method) external-format
+                 close-callback)
   "Returns an SSL stream for the server socket descriptor SOCKET.
 CERTIFICATE is the path to a file containing the PEM-encoded certificate for
  your server. KEY is the path to the PEM-encoded key for the server, which
@@ -191,6 +200,7 @@
   (ensure-initialized method)
   (let ((stream (make-instance 'ssl-server-stream
 		 :socket socket
+		 :close-callback close-callback
 		 :certificate certificate
 		 :key key))
         (handle (ssl-new *ssl-global-context*)))




More information about the cl-plus-ssl-cvs mailing list