[cl-plus-ssl-devel] Two LISTEN bugs

Ron Garret ron at flownet.com
Tue May 11 19:06:14 UTC 2010


On May 11, 2010, at 11:58 AM, Anton Vodonosov wrote:

> Hello Ron, 
> 
> "Ron Garret" <ron at flownet.com>:
>> Is anyone actually maintaining CL+SSL?  The list seems to be pretty inactive.  
> 
> David Lichteblau, the original author of cl+ssl, currently doesn't have time/need to work on cl+ssl (as he explained); but he sometimes suggests how investigate bugs, or commits patches submitted by users.
> 
> I also have commit acces to the repositoy. I asked for it when there were several ananswered patch suggestions in the list - just to help to commit the patches. I usually do not investigate problems for which I don't have an answer, because I do not know cl+ssl better than other users. 
> 
> What I do is reading the list and make sure that the efforts people made by creating patches do not get lost - i can review and commit a patch.
> 
>> I went ahead and fixed this problem, and I'm wondering if I should submit a patch (and who I should submit it to).
> 
> Could you please send the patch to the mailing list?
> 


NOTE: This has only been tested on CCL.

; Bug fix: if you call LISTEN (or, presumably, peek-char) then read-char will return
; the same characer forever.  NOTE: input is not buffered, and :EOF is not handled
; properly.  Not sure if this is worth fixing.
(defmethod stream-read-byte ((stream ssl-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)
              (ensure-ssl-funcall stream
                                  (ssl-stream-handle stream)
                                  #'ssl-read
                                  (ssl-stream-handle stream)
                                  ptr
                                  1)
              (buffer-elt buf 0))
          (ssl-error-zero-return ()     ;SSL_read returns 0 on end-of-file
                                 :eof)))))

; Bug fix: stream-listen used to hang rather than return nil when no input
(defmethod stream-listen ((stream ssl-stream))
  (or (ssl-stream-peeked-byte stream)
      (setf (ssl-stream-peeked-byte stream)
            (let ((buf (ssl-stream-input-buffer stream)))
              (with-pointer-to-vector-data (ptr buf)
                (let ((n (ssl-read (ssl-stream-handle stream) ptr 1)))
                  (and (> n 1) (buffer-elt buf 0))))))))





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