[Twisted-Python] Problem in twisted.internet.tcp when using ssl

Martin Sjögren martin at strakt.com
Wed Jul 10 10:50:21 EDT 2002


The writeSomeData method of Connection objects may sometimes be called
with a zero length buffer. This works fine when using plain TCP, but
when using ssl, this will cause a ZeroReturnError (which is completely
bogus!) and everything...well...blows up.

Here's a patch:

Index: tcp.py
===================================================================
RCS file: /cvs/Twisted/twisted/internet/tcp.py,v
retrieving revision 1.75
diff -u -u -2 -r1.75 tcp.py
--- tcp.py      10 Jul 2002 00:00:57 -0000      1.75
+++ tcp.py      10 Jul 2002 14:49:29 -0000
@@ -100,4 +100,6 @@
         (which is negative)
         """
+        if not data:
+            return 0
         try:
             return self.socket.send(data)


Regards,
Martin

-- 
Martin Sjögren
  martin at strakt.com              ICQ : 41245059
  Phone: +46 (0)31 7710870       Cell: +46 (0)739 169191
  GPG key: http://www.strakt.com/~martin/gpg.html




More information about the Twisted-Python mailing list