From dlichteblau at common-lisp.net Sat May 8 15:55:56 2010 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 08 May 2010 11:55:56 -0400 Subject: [cl-plus-ssl-cvs] CVS trivial-gray-streams Message-ID: Update of /project/cl-plus-ssl/cvsroot/trivial-gray-streams In directory cl-net:/tmp/cvs-serv20519 Modified Files: mixin.lisp package.lisp Log Message: Commit ABCL patch submitted by Mark Evenson --- /project/cl-plus-ssl/cvsroot/trivial-gray-streams/mixin.lisp 2009/10/24 20:13:39 1.10 +++ /project/cl-plus-ssl/cvsroot/trivial-gray-streams/mixin.lisp 2010/05/08 15:55:55 1.11 @@ -29,6 +29,20 @@ (declare (ignore newval)) nil) +#+abcl +(progn + (defmethod gray-streams:stream-read-sequence + ((s trivial-gray-stream-mixin) seq &optional start end) + (stream-read-sequence s seq (or start 0) (or end (length seq)))) + + (defmethod gray-streams:stream-write-sequence + ((s trivial-gray-stream-mixin) seq &optional start end) + (stream-write-sequence s seq (or start 0) (or end (length seq)))) + + (defmethod gray-streams:stream-write-string + ((stream xp::xp-structure) string &optional (start 0) (end (length string))) + (xp::write-string+ string stream start end))) + #+allegro (progn (defmethod excl:stream-read-sequence --- /project/cl-plus-ssl/cvsroot/trivial-gray-streams/package.lisp 2009/10/24 20:13:39 1.6 +++ /project/cl-plus-ssl/cvsroot/trivial-gray-streams/package.lisp 2010/05/08 15:55:56 1.7 @@ -2,6 +2,10 @@ (in-package :cl-user) +#+:abcl +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :gray-streams)) + #+cmu (eval-when (:compile-toplevel :load-toplevel :execute) (require :gray-streams)) @@ -40,8 +44,9 @@ #+clisp :gray #+openmcl :ccl #+lispworks :stream - #+ecl :gray - #-(or sbcl allegro cmu clisp openmcl lispworks ecl) ... + #+ecl :gray + #+abcl :gray-streams + #-(or sbcl allegro cmu clisp openmcl lispworks ecl abcl) ... , at common-symbols) (:export #:trivial-gray-stream-mixin #:stream-read-sequence From avodonosov at common-lisp.net Sun May 23 23:20:19 2010 From: avodonosov at common-lisp.net (avodonosov) Date: Sun, 23 May 2010 19:20:19 -0400 Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory cl-net:/tmp/cvs-serv29245 Modified Files: reload.lisp Log Message: OpenSSL for windows version 1.0.0 changed .ddl file names: libssl32.dll -> ssleay32.dll --- /project/cl-plus-ssl/cvsroot/cl+ssl/reload.lisp 2009/10/24 20:09:40 1.7 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/reload.lisp 2010/05/23 23:20:19 1.8 @@ -18,7 +18,7 @@ (in-package :cl+ssl) (cffi:define-foreign-library libssl - (:windows "libssl32.dll") + (:windows "ssleay32.dll") (:darwin "libssl.dylib") (:unix (:or "libssl.so.0.9.8" "libssl.so" "libssl.so.4")) (t (:default "libssl3"))) From avodonosov at common-lisp.net Sun May 23 23:24:38 2010 From: avodonosov at common-lisp.net (avodonosov) Date: Sun, 23 May 2010 19:24:38 -0400 Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory cl-net:/tmp/cvs-serv30751 Modified Files: ffi.lisp streams.lisp test.lisp Log Message: Two LISTEN bugs: http://common-lisp.net/pipermail/cl-plus-ssl-devel/2010-May/000178.html --- /project/cl-plus-ssl/cvsroot/cl+ssl/ffi.lisp 2009/10/24 20:09:40 1.13 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/ffi.lisp 2010/05/23 23:24:38 1.14 @@ -230,6 +230,21 @@ (t (ssl-signal-error handle func error nbytes))))))) +(declaim (inline nonblocking-ssl-funcall)) +(defun nonblocking-ssl-funcall (stream handle func &rest args) + (loop + (let ((nbytes + (let ((*socket* stream)) ;for Lisp-BIO callbacks + (apply func args)))) + (when (plusp nbytes) + (return nbytes)) + (let ((error (ssl-get-error handle nbytes))) + (case error + ((#.+ssl-error-want-read+ #.+ssl-error-want-write+) + (return nbytes)) + (t + (ssl-signal-error handle func error nbytes))))))) + ;;; Waiting for output to be possible --- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2009/10/24 20:09:40 1.18 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2010/05/23 23:24:38 1.19 @@ -83,12 +83,21 @@ (defmethod stream-listen ((stream ssl-stream)) (or (ssl-stream-peeked-byte stream) (setf (ssl-stream-peeked-byte stream) - (let* ((*blockp* nil) - (b (stream-read-byte stream))) - (if (eql b :eof) nil b))))) + (let ((buf (ssl-stream-input-buffer stream))) + (with-pointer-to-vector-data (ptr buf) + (let* ((*blockp* nil) ;; for the Lisp-BIO + (n (nonblocking-ssl-funcall stream + (ssl-stream-handle stream) + #'ssl-read + (ssl-stream-handle stream) + ptr + 1))) + (and (> n 0) (buffer-elt buf 0)))))))) (defmethod stream-read-byte ((stream ssl-stream)) - (or (ssl-stream-peeked-byte stream) + (or (prog1 + (ssl-stream-peeked-byte stream) + (setf (ssl-stream-peeked-byte stream) nil)) (let ((buf (ssl-stream-input-buffer stream))) (handler-case (with-pointer-to-vector-data (ptr buf) --- /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2008/03/07 21:27:44 1.4 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2010/05/23 23:24:38 1.5 @@ -365,7 +365,23 @@ (assert (> n 100)))) (handler-case (close-socket socket :abort t) - (sb-sys:deadline-timeout ()))))))) + (sb-sys:deadline-timeout ())))))) + + #+sbcl + (deftests read-char-no-hang/test (usp nil t :caller) + (with-thread ("echo server for read-char-no-hang test" + (lambda () (init-server :unwrap-stream-p usp)) + #'test-server) + (sb-sys:with-deadline (:seconds 3) + (with-open-stream (socket (init-client :unwrap-stream-p usp)) + (write-line "test" socket) + (force-output socket) + (assert (equal (read-line socket) "(echo test)")) + (handler-case + (when (read-char-no-hang socket) + (error "unexpected data")) + (sb-sys:deadline-timeout () + (error "read-char-no-hang hangs")))))))) #+(or) (run-all-tests) From avodonosov at common-lisp.net Tue May 25 20:17:40 2010 From: avodonosov at common-lisp.net (avodonosov) Date: Tue, 25 May 2010 16:17:40 -0400 Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory cl-net:/tmp/cvs-serv18734 Modified Files: test.lisp Log Message: Added CCL test for the READ-CHAR-NO-HANG. Mail thread "Two LISTEN bugs": http://common-lisp.net/pipermail/cl-plus-ssl-devel/2010-May/000178.html --- /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2010/05/23 23:24:38 1.5 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2010/05/25 20:17:39 1.6 @@ -212,6 +212,35 @@ :close-callback callback :external-format :iso-8859-1))) +;; CCL requires specifying the +;; deadline at the socket cration ( +;; in constrast to SBCL which has +;; the WITH-TIMEOUT macro). +;; +;; Therefore a separate INIT-CLIENT +;; function is needed for CCL when +;; we need read/write deadlines on +;; the SSL client stream. +#+clozure-common-lisp +(defun ccl-init-client-with-deadline (&key (unwrap-stream-p t) + seconds) + (let* ((deadline + (+ (get-internal-real-time) + (* seconds internal-time-units-per-second))) + (low + (record-socket + (ccl:make-socket + :address-family :internet + :connect :active + :type :stream + :remote-host "127.0.0.1" + :remote-port *port* + :deadline deadline)))) + (cl+ssl:make-ssl-client-stream + low + :unwrap-stream-p unwrap-stream-p + :external-format :iso-8859-1))) + ;;; Simple echo-server test. Write a line and check that the result ;;; watches, three times in a row. (deftest echo @@ -258,32 +287,19 @@ (with-thread ("echo server for deadline test" (lambda () (init-server :unwrap-stream-p usp)) #'test-server) - (let* ((deadline - (+ (get-internal-real-time) - (* 3 internal-time-units-per-second))) - (low - (record-socket - (ccl:make-socket - :address-family :internet - :connect :active - :type :stream - :remote-host "127.0.0.1" - :remote-port *port* - :deadline deadline)))) - (with-open-stream - (socket - (cl+ssl:make-ssl-client-stream - low - :unwrap-stream-p usp - :external-format :iso-8859-1)) - (write-line "test" socket) - (force-output socket) - (assert (equal (read-line socket) "(echo test)")) - (handler-case - (progn - (read-char socket) - (error "unexpected data")) - (ccl::communication-deadline-expired ())))))) + (with-open-stream + (socket + (ccl-init-client-with-deadline + :unwrap-stream-p usp + :seconds 3)) + (write-line "test" socket) + (force-output socket) + (assert (equal (read-line socket) "(echo test)")) + (handler-case + (progn + (read-char socket) + (error "unexpected data")) + (ccl::communication-deadline-expired ()))))) #+sbcl (deftests read-deadline (usp nil t :caller) @@ -306,41 +322,29 @@ (with-thread ("echo server for deadline test" (lambda () (init-server :unwrap-stream-p usp)) #'test-server) - (let* ((deadline - (+ (get-internal-real-time) - (* 3 internal-time-units-per-second))) - (low - (record-socket - (ccl:make-socket - :address-family :internet - :connect :active - :type :stream - :remote-host "127.0.0.1" - :remote-port *port* - :deadline deadline))) - (socket - (cl+ssl:make-ssl-client-stream - low - :unwrap-stream-p usp - :external-format :iso-8859-1))) - (unwind-protect - (progn - (write-line "test" socket) - (force-output socket) - (assert (equal (read-line socket) "(echo test)")) - (write-line "freeze" socket) - (force-output socket) - (let ((n 0)) - (handler-case - (loop - (write-line "deadbeef" socket) - (incf n)) - (ccl::communication-deadline-expired ())) - ;; should have written a couple of lines before the deadline: - (assert (> n 100)))) - (handler-case - (close-socket socket :abort t) - (ccl::communication-deadline-expired ())))))) + (with-open-stream + (socket + (ccl-init-client-with-deadline + :unwrap-stream-p usp + :seconds 3)) + (unwind-protect + (progn + (write-line "test" socket) + (force-output socket) + (assert (equal (read-line socket) "(echo test)")) + (write-line "freeze" socket) + (force-output socket) + (let ((n 0)) + (handler-case + (loop + (write-line "deadbeef" socket) + (incf n)) + (ccl::communication-deadline-expired ())) + ;; should have written a couple of lines before the deadline: + (assert (> n 100)))) + (handler-case + (close-socket socket :abort t) + (ccl::communication-deadline-expired ())))))) #+sbcl (deftests write-deadline (usp nil t) @@ -367,6 +371,24 @@ (close-socket socket :abort t) (sb-sys:deadline-timeout ())))))) + #+clozure-common-lisp + (deftests read-char-no-hang/test (usp nil t :caller) + (with-thread ("echo server for read-char-no-hang test" + (lambda () (init-server :unwrap-stream-p usp)) + #'test-server) + (with-open-stream + (socket (ccl-init-client-with-deadline + :unwrap-stream-p usp + :seconds 3)) + (write-line "test" socket) + (force-output socket) + (assert (equal (read-line socket) "(echo test)")) + (handler-case + (when (read-char-no-hang socket) + (error "unexpected data")) + (ccl::communication-deadline-expired () + (error "read-char-no-hang hangs")))))) + #+sbcl (deftests read-char-no-hang/test (usp nil t :caller) (with-thread ("echo server for read-char-no-hang test" From avodonosov at common-lisp.net Tue May 25 21:15:42 2010 From: avodonosov at common-lisp.net (avodonosov) Date: Tue, 25 May 2010 17:15:42 -0400 Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory cl-net:/tmp/cvs-serv467 Modified Files: test.lisp Log Message: minor fix in the READ-DEADLINE test for CCL: added UNWRAP-STREAM-P = :CALLER case --- /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2010/05/25 20:17:39 1.6 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2010/05/25 21:15:42 1.7 @@ -283,7 +283,7 @@ (assert (equal (read-line socket) "(echo test)"))))) #+clozure-common-lisp - (deftests read-deadline (usp nil t) + (deftests read-deadline (usp nil t :caller) (with-thread ("echo server for deadline test" (lambda () (init-server :unwrap-stream-p usp)) #'test-server) From avodonosov at common-lisp.net Tue May 25 22:06:51 2010 From: avodonosov at common-lisp.net (avodonosov) Date: Tue, 25 May 2010 18:06:51 -0400 Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory cl-net:/tmp/cvs-serv15120 Modified Files: index.html Log Message: described the recent changes in the News secion of index.html --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2009/09/16 21:33:32 1.25 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2010/05/25 22:06:51 1.26 @@ -227,6 +227,22 @@

News

+ 2010-05-26 +

+
    +
  • + Fixed two bugs in LISTEN, thanks to Ron Garret. +
  • +
+

+ 2010-05-23 +

+
    +
  • + Windows: use new .dll names according to the Win32 OpenSSL version 1.0.0: libeay32.dll and ssleay32.dll. +
  • +
+

2009-09-17

    From avodonosov at common-lisp.net Fri May 28 09:39:01 2010 From: avodonosov at common-lisp.net (avodonosov) Date: Fri, 28 May 2010 05:39:01 -0400 Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory cl-net:/tmp/cvs-serv27016 Modified Files: index.html reload.lisp Log Message: rollback unnecessary DLL name change on Windows: libssl32.dll is present in OpenSSL-Win32 as before, but not in the directory were I expected it --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2010/05/25 22:06:51 1.26 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2010/05/28 09:39:01 1.27 @@ -235,14 +235,6 @@

- 2010-05-23 -

-
    -
  • - Windows: use new .dll names according to the Win32 OpenSSL version 1.0.0: libeay32.dll and ssleay32.dll. -
  • -
-

2009-09-17

    --- /project/cl-plus-ssl/cvsroot/cl+ssl/reload.lisp 2010/05/23 23:20:19 1.8 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/reload.lisp 2010/05/28 09:39:01 1.9 @@ -18,7 +18,7 @@ (in-package :cl+ssl) (cffi:define-foreign-library libssl - (:windows "ssleay32.dll") + (:windows "libssl32.dll") (:darwin "libssl.dylib") (:unix (:or "libssl.so.0.9.8" "libssl.so" "libssl.so.4")) (t (:default "libssl3")))